+ Reply to Thread
Results 1 to 3 of 3

Copy & Paste Macro - Help Needed

  1. #1
    Registered User
    Join Date
    11-03-2010
    Location
    Costa Mesa, California
    MS-Off Ver
    Excel 2003
    Posts
    28

    Copy & Paste Macro - Help Needed

    Hi,

    I have a macro that moves data from the INPUT tab to TWO other tabs. There are two parts to the macro:
    1. Compare the locations listed in the imported rows of data against a "master location list" in Column "U" of the INPUT tab.
    2. Move the rows of data to different tabs as defined by the macro script (i.e. if the location is Diamond Bar, then the row of data will get moved to sheet 24).

    The problem with this setup is that every time an additional new location needs to be added I have to add it to my list in Column "U" on the INPUT tab and then also update the script to A) have the script check this additional location in the "U" column and B) tell the script to move all rows with this new location to a specific sheet.

    I would love help figuring out how to have the script rotate through my list in "U" one at a time, assign a variable with a value of each "location name", and then move each row of data with the corresponding name to the tab that has the same name as the current location stored in the variable. It would need to cycle through the list of locations in Column "U" until it senses that there are no further values in the column to cycle through. (i.e. "U2:U2 is the location "Newport Beach", so move all rows of data that have "Newport Beach" in the A column to the tab that is titled "Newport Beach")

    I have attached a sample to this post.

    Thanks in advance for your ideas!
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Copy & Paste Macro - Help Needed

    Try this.
    • This will filter for each unique location in column L on the Input sheet and copy the filtered rows to its named worksheet and the AllBranches sheet.
    • If a location doesn't have a named worksheet, it will copy the Template worksheet and rename the copy as the new location.
    • Before running this code, first copy one of the empty location sheets and name it Template. You could hide the Template sheet if you want.
    • The code doesn't use the location list in column U on the Input sheet

    Please Login or Register  to view this content.
    Last edited by AlphaFrog; 10-16-2013 at 09:57 PM.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    11-03-2010
    Location
    Costa Mesa, California
    MS-Off Ver
    Excel 2003
    Posts
    28

    Re: Copy & Paste Macro - Help Needed

    Thanks AlphaFrog! It works wonderfully. I'll mark this as "Resolved", and again, thanks for the quick response!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Simple copy and paste macro- Paste special help needed.
    By hernancrespo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-20-2012, 07:02 AM
  2. macro help needed to copy and paste
    By bsesender in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-15-2012, 05:17 PM
  3. Replies: 1
    Last Post: 10-28-2012, 01:13 AM
  4. Copy and Paste Macro needed
    By dinesababu1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-11-2012, 04:20 AM
  5. Macro needed for copy paste!
    By rukia in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-02-2010, 07:54 AM

Tags for this Thread

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