+ Reply to Thread
Results 1 to 7 of 7

Need help with macro to copy and paste data from multiple ranges to new sheet

  1. #1
    Registered User
    Join Date
    09-12-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    20

    Need help with macro to copy and paste data from multiple ranges to new sheet

    The following macro will only work for ranges within either column c or f but not both. I need it to work for all the ranges specified in the c and f columns. As it sits I get the error "That command cannot be used on multiple selections." In the debugger it is getting hung up on the r.copy line. Here is my macro:

    Please Login or Register  to view this content.
    Any suggestions?
    Moderator's edit: Use code tags when posting code. To do so in future, select the code and click on the # icon at the top of your post window.
    Last edited by arlu1201; 01-04-2013 at 01:58 PM.

  2. #2
    Forum Contributor
    Join Date
    09-22-2012
    Location
    Berkeley, CA
    MS-Off Ver
    Excel 2010
    Posts
    112

    Re: Need help with macro to copy and paste data from multiple ranges to new sheet

    I've never tried to paste a non-continuous range. You might have to paste each specific range separately.
    ------------------------
    W2

  3. #3
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Need help with macro to copy and paste data from multiple ranges to new sheet

    Yes, that is right, the command will not work on multi selection

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    09-22-2012
    Location
    Berkeley, CA
    MS-Off Ver
    Excel 2010
    Posts
    112

    Re: Need help with macro to copy and paste data from multiple ranges to new sheet

    Is it working properly now? I looked at the output and it transposes the two columns into two rows. Is that what you need?

  5. #5
    Registered User
    Join Date
    09-12-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: Need help with macro to copy and paste data from multiple ranges to new sheet

    Thanks for the help, I need the output to be on one row with the data from column C to be preceded by the data in column F.

  6. #6
    Forum Contributor
    Join Date
    09-22-2012
    Location
    Berkeley, CA
    MS-Off Ver
    Excel 2010
    Posts
    112

    Re: Need help with macro to copy and paste data from multiple ranges to new sheet

    Just change the offset values for the second range paste:

    Please Login or Register  to view this content.
    Let me know if that works for you.

  7. #7
    Registered User
    Join Date
    09-12-2012
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    20

    Re: Need help with macro to copy and paste data from multiple ranges to new sheet

    Thanks Cofad/AB33. The solution works perfect. Greatly appreciated!

+ 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