+ Reply to Thread
Results 1 to 4 of 4

Copy active row and paste to specific cells on different sheet

  1. #1
    Registered User
    Join Date
    11-07-2012
    Location
    Midwest, US
    MS-Off Ver
    Excel 2010
    Posts
    26

    Copy active row and paste to specific cells on different sheet

    Hello Everyone,

    I am trying to create a sheet that logs test data. Real simple, a user would be entering the same data sets for different samples. Each individual sample would have it's own row.

    The second sheet (Sheet2) I created a "Final Test Report" form (so it prints good) where I would like to have the data of the active row from Sheet1 be copied and pasted to. I am new to VBA so I cannot figure out how to copy the active row and paste it to Specific cells in a different sheet.

    So, the starting row range in Sheet1 is A5:H5.

    Sheet2 C11 = Sheet1, Column1 (Active Row)
    Sheet2 C14 = Sheet1, Column2 (Active Row)
    Sheet2 C15 = Sheet1, Column3 (Active Row)
    Sheet2 C16 = Sheet1, Column4 (Active Row)
    Sheet2 E12 = Sheet1, Column5 (Active Row)
    Sheet2 E14 = Sheet1, Column6 (Active Row)
    Sheet2 E15 = Sheet1, Column7 (Active Row)
    Sheet2 E16 = Sheet1, Column8 (Active Row)

    Hopefully this makes sense and thank you if you have kept reading.. My vision is to allow me to create a Final Test report from any row I choose from a push of a button.
    I can figure out how to copy & past the entire row but I am not advanced enough in VBA to figure out something so specific.

    I appreciate all suggestions.

    Thanks
    -CM

  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: Copy active row and paste to specific cells on different sheet

    The basic technique:

    1) Store the needed row in a variable
    2) Use that row variable to transfer data from that row to the target cells on sheet 2.

    Please Login or Register  to view this content.
    _________________
    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
    11-07-2012
    Location
    Midwest, US
    MS-Off Ver
    Excel 2010
    Posts
    26

    Re: Copy active row and paste to specific cells on different sheet

    Hi JB,

    Couldn't get your suggestion to work. It is more than likely something I am doing wrong. I am very new to VBA.
    Thank you for replying.

    Here is what I came up with..
    Please Login or Register  to view this content.
    Not sure is this most efficient method or cleanest coding practice but it accomplishes what I need it to do. If you see something completely wrong from what I did please let me know.

    The next thing I would like to accomplish is being able to highlight multiple rows and it would copy & paste on Sheet2 then print, row by row.
    Probably need to start a new thread.

    -CM

  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: Copy active row and paste to specific cells on different sheet

    You didn't apply my suggestion. Use my syntax and try again. I noticed the source cells are different in your version from what you originally cited. Does Sheet2!C11 get the value from column A or column B? Adjust my code to match the correct source columns.

+ 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