Copy from one worksheet to another with paste value

OliverTheLapponian

New Member
Joined
Jan 6, 2022
Messages
7
Office Version
  1. 365
Platform
  1. 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
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
For 3. try this:

wsDest.Range("A2:J" & lDestLastRow).Value = wsCopy.Range("A2:J" & lCopyLastRow).Value
 
Upvote 0
Solution

Forum statistics

Threads
1,224,820
Messages
6,181,159
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top