OzGrid

How to copy selected data and paste to the last row of another sheet

< Back to Search results

 Category: [Excel]  Demo Available 

How to copy selected data and paste to the last row of another sheet

 

Requirement:

 

The user is trying to prepare a report; In the Sheet1, range is F3 to H3. The user would like to copy this values to Sheet2. However, each time the macro is run, it starts to paste from A2 to down (only F3 value!).

 

https://www.ozgrid.com/forum/forum/help-forums/excel-vba-macros/148148-copy-selected-data-and-paste-to-the-last-row-of-another-sheet

 

Solution:

 

Code:
Sub Lister()
Dim lRow As Long
    lRow = Worksheets("Sheet2").Cells(Worksheets("Sheet2").Rows.Count, 1).End(xlUp).Row
    Worksheets("Sheet2").Range("A" & lRow + 1 & ":C" & lRow + 1).Value = Worksheets("Sheet1").Range("F3:H3").Value
End Sub

 

Obtained from the OzGrid Help Forum.

Solution provided by Carim.

 

See also: Index to Excel VBA Code and Index to Excel Freebies and Lesson 1 - Excel Fundamentals and Index to how to… providing a range of solutions and Index to new resources and reference sheets

 

See also:

How to create VBA code to update cell based on worksheet change in corresponding row
How to create VBA code for creating hyperlink depending on worksheet change
How to create code to calculate total length installed based on number of pages that are entered
How to change fill color of autoshapes based on result of formula in a cell
How to copy cell if cell contains the value to the previous column but the same row

 

Click here to visit our Free 24/7 Excel/VBA Help Forum where there are thousands of posts you can get information from, or you can join the Forum and post your own questions.


Gallery



stars (0 Reviews)