Hi all,
I need to copy a range of data eg: (B9: M9) till the last row of the current worksheet >Temp, and paste it in another workbook of another sheet -> "Data" based on the last row from the column B.
Tried out macro recordings and code stuff. But still, it does not work out.
Attached the sample source data screenshot for your reference.
CODE:
Please help out.
I need to copy a range of data eg: (B9: M9) till the last row of the current worksheet >Temp, and paste it in another workbook of another sheet -> "Data" based on the last row from the column B.
Tried out macro recordings and code stuff. But still, it does not work out.
Attached the sample source data screenshot for your reference.
CODE:
VBA Code:
Sub sample()
Dim LRSrc As Long, LRDest As Long, SrcRng As Range
fromPath = Sheets("Instructions").Range("B2")
Set wkb = ThisWorkbook
Set wkbFrom = Workbooks.Open(fromPath)
wkb.Sheets("Temp").Select
With ThisWorkbook.Sheets("Temp")
LRSrc = .Cells(.Rows.Count, 2).End(xlUp).Row
Set SrcRng = .Range("B9:Z3000" & LRSrc)
End With
' With Sheets("Data")
With wkbFrom.Sheets("Data")
LRDest = .Cells(.Rows.Count, 2).End(xlUp).Row
SrcRng.copy .Cells(LRDest + 1, 2)
End With
End Sub
Please help out.