+ Reply to Thread
Results 1 to 8 of 8

Pulling contacts to a new sheet automatically

  1. #1
    Registered User
    Join Date
    10-30-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Pulling contacts to a new sheet automatically

    This may have been answered before but I'm having a hard time figuring out what search terms to use to find it. But here is my problem for those who can look past my lack of searching ability.

    I have a list of contacts that I contact for certain projects. Depending on the project, I will send an email to different people each time. The contacts are all in an excel file as a master list. I would like to have a way to where I could quickly select which contacts I want for a certain project and then have a new list be created on the next sheet with all the same info. I figured I could create a column, for example, that I would put a Y in if I wanted to include that person. Then I would run a function/macro which would copy each person's info across multiple columns and paste that into the next spreadsheet. So in the end, the new sheet will have a list of only those contacts I want and I can add more info to the list without sifting through the huge contact list.

    Thanks for any ideas.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Pulling contacts to a new sheet automatically

    You can use the Autofilter for that.

    1) Go down your column putting in Y or X for the contacts you want.
    2) Turn on the Autofilter on that column, filter for Y
    3) Copy all visible data to another new sheet
    4) Turn off the autofilter and clear the column for next time.


    You should be able to record that into a macro pretty simply.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    10-30-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Pulling contacts to a new sheet automatically

    Thanks, that should do it.

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Pulling contacts to a new sheet automatically

    If that takes care of your original query, please select Thread Tools from the menu above and mark the thread as solved. Thanks.

  5. #5
    Registered User
    Join Date
    10-30-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Pulling contacts to a new sheet automatically

    I am having an additional problem with this. I got the macro to work for the most part but when it is added to the second sheet I am having trouble getting it to format as a table correctly. I have a few column headings set up in the second sheet before I add the new data. Then I grab the data from the first sheet and paste it to the right of the new columns. That is fine. My new question is: can I have excel automatically format all the data as a table (with colors and so I can sort by each column if necessary)? I can get it to work with a set number of cells that I can just record into the macro but since the number of entries copied over changes each time I need a way to only format the cells where there is data.

    The code generated from the macro that I used to create a table style for the defined cells is:


    Please Login or Register  to view this content.
    A1 is always my starting point and Q is always the ending column but the row for Q changes. Can I change the 7 into a variable that represents the total number of rows?
    Last edited by JBeaucaire; 10-31-2012 at 12:29 PM. Reason: Added code tags, as per forum rules. Don't forget!

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Pulling contacts to a new sheet automatically

    Let's see your code, might help me grasp your problem.

  7. #7
    Registered User
    Join Date
    10-30-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Pulling contacts to a new sheet automatically

    I edited it into my post above.

    So basically, say you have a table of unknown length. All I want to do is use excel's 'format as table' tool to use a table style and define headers. Since that length changes each time I use this, I was thinking you could define a variable that would represent the total number of rows. Then use this variable for the ending range of a selection to format the table.
    Last edited by archie8; 10-31-2012 at 11:26 AM.

  8. #8
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Pulling contacts to a new sheet automatically

    Dim a Long variable, use it to store the value of the last used row, then use that in your processes:

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1