I have been trying to make a code which copies the UsedRange from Sheet1 and Paste that range into Sheet3.
Upon running the code each time UsedRange will be paste into Sheet3 from first empty Row.
For Example: There are 5 rows (1st Row will always be Header) in the Sheet1 with data i will press run the code will copy and paste the data into Sheet3 Row2 (1st Row will always be Header).
So now the Sheet3 has data till Row5 I will press the run button again then data will be pasted from Row6.
Upon pressing button each time data will be paste accordingly. I got a code online and tried to edit it but its not working as i want.
Your help will be greatly appreciated.
Code.
Sub usedrange()
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Dim source As Range
Dim target As Range
Dim lastColumn As Long
Set ws1 = Worksheets("NewSheet")
Set ws2 = Sheet3
With ws2
lastrow = .Cells(Rows.Count, 1).End(xlUp).Row
If WorksheetFunction.CountA(.Rows(1)) > 0 Then
lastrow = lastrow + 1
End If
End With
Set source = ws1.usedrange.Offset(1)
Set target = ws2.Cells(, lastrow)
source.Copy Destination:=target
Application.CutCopyMode = False
End Sub