How to copy or append the data to one sheet to another sheet?

Rampage598

New Member
Joined
Mar 11, 2022
Messages
23
Office Version
  1. 365
Platform
  1. Windows
1647237761005.png

I want to copy all the data from 2nd row from sheet2 to sheet1.... but there is one condition if there is already have some data into sheet1 then it will append the data to it from sheet2 to sheet1
1647237921348.png

How to do this in excel macro?
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Try this

VBA Code:
Sub Rampage598()
    Dim ws1 As Worksheet, ws2 As Worksheet
    Dim lr1 As Long, lr2 As Long
    
    Set ws1 = Worksheets("Sheet1")
    Set ws2 = Worksheets("Sheet2")
    lr1 = ws1.Cells(Rows.Count, 1).End(3).Row + 1
    lr2 = ws2.Cells(Rows.Count, 1).End(3).Row
    
    ws2.Range(ws2.Cells(2, 1), ws2.Cells(lr2, 3)).Copy ws1.Cells(lr1, 1)
End Sub
 
Upvote 0
Solution
Try this

VBA Code:
Sub Rampage598()
    Dim ws1 As Worksheet, ws2 As Worksheet
    Dim lr1 As Long, lr2 As Long
   
    Set ws1 = Worksheets("Sheet1")
    Set ws2 = Worksheets("Sheet2")
    lr1 = ws1.Cells(Rows.Count, 1).End(3).Row + 1
    lr2 = ws2.Cells(Rows.Count, 1).End(3).Row
   
    ws2.Range(ws2.Cells(2, 1), ws2.Cells(lr2, 3)).Copy ws1.Cells(lr1, 1)
End Sub
Thanks its working properly :)
 
Upvote 0

Forum statistics

Threads
1,213,550
Messages
6,114,265
Members
448,558
Latest member
aivin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top