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

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
For 3. try this:

wsDest.Range("A2:J" & lDestLastRow).Value = wsCopy.Range("A2:J" & lCopyLastRow).Value
 
Upvote 0
Solution
You are welcome - thanks for the reply.
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,257
Members
449,075
Latest member
staticfluids

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