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

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

JoeMo

MrExcel MVP
Joined
May 26, 2009
Messages
17,883
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
For 3. try this:

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

JoeMo

MrExcel MVP
Joined
May 26, 2009
Messages
17,883
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
You are welcome - thanks for the reply.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,477
Messages
5,831,904
Members
430,090
Latest member
bjonesh2o

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
Top