Hello,
I've been trying to get this to work:
I have one workbook which contains new data every week. When I run the macro I want it to open that workbook and copy data from a set range into the workbook that contains the executed macro.
The set range to copy is from one cell (top left) to the end of the worksheet 6 (bottom right). I was able to save the bottom left cell to copy into a variable but I can't figure out a way to use it in my copy range.
Kind regards,
Daniel.
I've been trying to get this to work:
I have one workbook which contains new data every week. When I run the macro I want it to open that workbook and copy data from a set range into the workbook that contains the executed macro.
The set range to copy is from one cell (top left) to the end of the worksheet 6 (bottom right). I was able to save the bottom left cell to copy into a variable but I can't figure out a way to use it in my copy range.
Code:
Private Sub ADRMoP_Click()
Dim ADRM As Workbook
Set ADRM = Workbooks.Open("<Workbook Address on Drive>")
Dim EndCell As Range
' Bottom left cell as variable
Set EndCell = ADRM.Sheets(6).Range("A1").SpecialCells(xlCellTypeLastCell).Offset(-2, 0)
Dim CopyRange As Range
' Here's my problem. I can't put the variable into my range method
Set CopyRange = ADRM.Sheets(6).Range("B3:EndCell.Address()")
CopyRange.Copy
Sheets("Line Items_oP").Range("B4").Paste
ADRM.Close
End Sub
Kind regards,
Daniel.