I have a sheet with two tabs:
on tab 1 I have a contiguous block of data in Columns J,K that varies in the number of rows but always starts from J1, K1.
On tab 2 I have a data in Column A only, starting from A1.
I am looking for the code that will enable me to dynamically select the entire block of data in tab 1, however many rows deep that may be.
then paste that block, it starting at the first empty cell in column A in tab 2.
This is my attempt thus far:
Sub put_there2()
Dim r1 As Range
Dim r2 As Range
Dim r3 As Range
Dim LastRowNumber As Long
Dim LastCell As Range
Dim WS As Worksheet
Set r1 = Range("A2:A100") 'Paste Location
Set WS = Worksheets("Sheet1")
With WS ' sheet in which to measure range of data to be pasted
Set LastCell = .Cells(.Rows.Count, 10).End(xlUp)
LastRowNumber = LastCell.Row
End With
Set r2 = Range(Cells(2, 10), Cells(LastRowNumber, 11)) 'region to be copied
For Each r3 In r1
If r3.Value = "" Then
r2.Copy r3
Exit Sub
End If
Next
End Sub
Your thoughts are appreciated,
Best regards