ExcelNoob222
Board Regular
- Joined
- Jun 17, 2020
- Messages
- 77
- Office Version
- 365
- Platform
- Windows
Hi,
I have a workbook that goes from column A to J. Previously I would copy B to J from one worksheet to another use the below code:
However going forward, J will not always be the last column. Sometimes it may be M or P etc. So I wondering if there is something similar to "LastRow = Worksheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row" for columns and if my "Range("B10:J" & LastRow).Copy" code can be modified where J is replaced with the last column?
Thanks!
I have a workbook that goes from column A to J. Previously I would copy B to J from one worksheet to another use the below code:
VBA Code:
Dim LastRow As Long
LastRow = Worksheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row
Range("B10:J" & LastRow).Copy
However going forward, J will not always be the last column. Sometimes it may be M or P etc. So I wondering if there is something similar to "LastRow = Worksheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row" for columns and if my "Range("B10:J" & LastRow).Copy" code can be modified where J is replaced with the last column?
Thanks!