+ Reply to Thread
Results 1 to 9 of 9

How to Design a Macro to Copy/Paste Specific Columns to Another Sheet in Specific Columns

  1. #1
    Registered User
    Join Date
    04-01-2013
    Location
    Dallas, TX
    MS-Off Ver
    Excel Pro 2010
    Posts
    6

    How to Design a Macro to Copy/Paste Specific Columns to Another Sheet in Specific Columns

    I am trying to design a Macro to Copy/Paste value and formatting from one sheet that is linked to other workbooks already into another worksheet that can then include other formulas, formatting and have a sort list to change the order of the data ect.

    - Select Specific Columns (max 500 rows of data needed) from the Summary Sheet
    - Copy to the Well Stats tab into specific columns that will be in a different order than in the Summary Sheet and will need some columns in between that won't be copied but will instead perform their own calculations


    This is the code that I have started but I'm afraid that it will run very slowly once I actually setup 20-30 columns to copy/paste over. Is there a simpler code? I have attached my excel sheet. Thanks in advance!

    Code:
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by davesexcel; 04-02-2013 at 07:09 PM. Reason: code tags required

  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: How to Design a Macro to Copy/Paste Specific Columns to Another Sheet in Specific Colu

    Once you stop flipping back and forth unnecessary between sheets, this should be efficient enough, even after you expand to 20+ columns.
    Please Login or Register  to view this content.
    By setting your worksheet names into variables at the top of the code, then using the variable names in the COPY and PASTE commands, you can change your sheet names anytime you want and only have to edit the SET commands at the top, then that change flows down through the code automatically.
    _________________
    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
    03-31-2013
    Location
    Adelaide
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: How to Design a Macro to Copy/Paste Specific Columns to Another Sheet in Specific Colu

    My situation is quite similar.

    But in my case I have to clear the data all the times and I want to store the new values bottom of every rows.

  4. #4
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: How to Design a Macro to Copy/Paste Specific Columns to Another Sheet in Specific Colu

    Welcome to the forum ankitsondhi may I suggest you to create a new thread for your query.
    Thanks
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

  5. #5
    Registered User
    Join Date
    04-01-2013
    Location
    Dallas, TX
    MS-Off Ver
    Excel Pro 2010
    Posts
    6

    Re: How to Design a Macro to Copy/Paste Specific Columns to Another Sheet in Specific Colu

    I greatly appreciate your help. However, this code is still not working if I have a blank column of data. It's double the data and not pasting it quite where I need it. Please see attached file to better explain my issue. Thanks!

    Well Review Form - Summary.xlsm

  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: How to Design a Macro to Copy/Paste Specific Columns to Another Sheet in Specific Colu

    The macro absolutely pastes exactly as you've described in your original post. Perhaps instead of talking in VBA code, you should simply mockup another WELL sheet that shows what you want the results to be passed on the sample SUMMARY sheet.

  7. #7
    Registered User
    Join Date
    04-01-2013
    Location
    Dallas, TX
    MS-Off Ver
    Excel Pro 2010
    Posts
    6

    Re: How to Design a Macro to Copy/Paste Specific Columns to Another Sheet in Specific Colu

    Attached is how I think it "should" copy based on the code that you submitted.

    G Column copies to Column A, F to B, and O to C.

    It seems like if F is blank then it throws off the copy function.

    Test Copy.xlsm

  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: How to Design a Macro to Copy/Paste Specific Columns to Another Sheet in Specific Colu

    Please Login or Register  to view this content.
    Just some range typos, sorry. Be sure to get the columns noted correctly as you add more, better than I did the first time.

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

    Re: How to Design a Macro to Copy/Paste Specific Columns to Another Sheet in Specific Colu

    Please Login or Register  to view this content.
    Just some range typos, sorry. Be sure to get the columns noted correctly as you add more, better than I did the first time.

+ 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