Hello,
I have been using the VBA below for copying and pasting a range into the next open row of data. I am wanting to modify this code to paste the data into the next open column instead of the next open row below. Any help would be greatly appreciated!
I have been using the VBA below for copying and pasting a range into the next open row of data. I am wanting to modify this code to paste the data into the next open column instead of the next open row below. Any help would be greatly appreciated!
Code:
Sub Copy_Paste_Below_Last_Cell()
'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 lCopyLastCol As Long
Dim lDestLastCol As Long
'Set variables for copy and destination sheets
Set wsCopy = Workbooks("Production Summary Shrink Report Aug 23 2021.xlsm").Worksheets("FNDWRR")
Set wsDest = Workbooks("Production Summary Shrink Report Aug 23 2021.xlsm").Worksheets("Sheet1")
'1. Find last used row in the copy range based on data in column A
lCopyLastRow = wsCopy.Cells(wsCopy.Rows.Count, "A").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, "A").End(xlUp).Offset(1).Row
'3. Copy & Paste Data
wsCopy.Range("A2:D" & lCopyLastRow).Copy _
wsDest.Range("A" & lDestLastRow)
End Sub