OliverTheLapponian
New Member
- Joined
- Jan 6, 2022
- Messages
- 7
- Office Version
- 365
- Platform
- Windows
Good morning all,
I currently have the following code written below that is a macro that will transfer data from my Capture worksheet to my Log worksheet under the next empty cell row however, I cannot seem to find a way to insert a VBA so the data copied from my Capture worksheet and pasted to my Log worksheet as paste value with no formulas so there is historical data that is static data and not dynamic data.
Any help would be greatly appreciated!
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 lCopyLastRow As Long
Dim lDestLastRow As Long
'Set variables for copy and destination sheets
Set wsCopy = Workbooks("DMS West Capacity 2022 v1.xlsm").Worksheets("Capture")
Set wsDest = Workbooks("DMS West Capacity 2022 v1.xlsm").Worksheets("Log")
'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:J" & lCopyLastRow).Copy _
wsDest.Range("A2:J" & lDestLastRow)
'Optional - Select the destination sheet
wsDest.Activate
End Sub
I currently have the following code written below that is a macro that will transfer data from my Capture worksheet to my Log worksheet under the next empty cell row however, I cannot seem to find a way to insert a VBA so the data copied from my Capture worksheet and pasted to my Log worksheet as paste value with no formulas so there is historical data that is static data and not dynamic data.
Any help would be greatly appreciated!
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 lCopyLastRow As Long
Dim lDestLastRow As Long
'Set variables for copy and destination sheets
Set wsCopy = Workbooks("DMS West Capacity 2022 v1.xlsm").Worksheets("Capture")
Set wsDest = Workbooks("DMS West Capacity 2022 v1.xlsm").Worksheets("Log")
'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:J" & lCopyLastRow).Copy _
wsDest.Range("A2:J" & lDestLastRow)
'Optional - Select the destination sheet
wsDest.Activate
End Sub