oblix
Board Regular
- Joined
- Mar 29, 2017
- Messages
- 183
- Office Version
- 365
- 2021
- 2019
- 2016
- 2013
- 2011
- 2010
- 2007
- 2003 or older
- Platform
- Windows
- MacOS
- Mobile
- Web
Hi there
The code I am Trying to get to copy from one sheet to another is:
Sub Copy_To_Received()
Call Clear_PO_Filter
Call Adv_Filter_PO
'Find the last used row in both sheets and copy and paste data below existing data.
Dim wsCopy As Worksheet
Dim wsDest As Worksheet
Dim lCopyLastRow As Long
Dim lDestLastRow As Long
'Set variables for copy and destination sheets
Set wsCopy = Worksheets("PO")
Set wsDest = Worksheets("Received")
'1. Find last used row in the copy range based on data in column A
lCopyLastRow = wsCopy.Cells(wsCopy.Rows.Count, "AS").End(xlUp).Row
'2. Find first blank row in the destination range based on data in column A
'Offset property moves down 1 row
lDestLastRow = wsDest.Cells(wsDest.Rows.Count, "B").End(xlUp).Offset(1).Row
'3. Copy & Paste Data
wsCopy.Range("AS6:AZ" & lCopyLastRow).Copy
wsDest.Range ("B" & lDestLastRow)
'Optional - Select the destination sheet
wsDest.Activate
End Sub
The problem is that it flags me with an error:
wsDest.Range ("B" & lDestLastRow) ".Range seems to be issue
Can some one please assit?
Thank you
The code I am Trying to get to copy from one sheet to another is:
Sub Copy_To_Received()
Call Clear_PO_Filter
Call Adv_Filter_PO
'Find the last used row in both sheets and copy and paste data below existing data.
Dim wsCopy As Worksheet
Dim wsDest As Worksheet
Dim lCopyLastRow As Long
Dim lDestLastRow As Long
'Set variables for copy and destination sheets
Set wsCopy = Worksheets("PO")
Set wsDest = Worksheets("Received")
'1. Find last used row in the copy range based on data in column A
lCopyLastRow = wsCopy.Cells(wsCopy.Rows.Count, "AS").End(xlUp).Row
'2. Find first blank row in the destination range based on data in column A
'Offset property moves down 1 row
lDestLastRow = wsDest.Cells(wsDest.Rows.Count, "B").End(xlUp).Offset(1).Row
'3. Copy & Paste Data
wsCopy.Range("AS6:AZ" & lCopyLastRow).Copy
wsDest.Range ("B" & lDestLastRow)
'Optional - Select the destination sheet
wsDest.Activate
End Sub
The problem is that it flags me with an error:
wsDest.Range ("B" & lDestLastRow) ".Range seems to be issue
Can some one please assit?
Thank you