copy and paste macro help.

steve400243

Active Member
Joined
Sep 15, 2016
Messages
429
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hello, I use this macro to copy and Paste from WS1 to WS2. But I need it to copy and paste new data on the next row down on Ws2 When the button is selected. I cant figure this out. Thanks for all help provided.

Code:
Sub ButtonCode()
    Dim ws1 As Worksheet, ws2 As Worksheet
    Dim DestRow As Long
    Set ws1 = Sheets("Cartage Rate")
    Set ws2 = Sheets("Complete")
    DestRow = ws2.Cells(Rows.Count, "A").End(xlUp).Row + 1
    ws1.Range("B3").Copy ws2.Range("B" & DestRow)
    ws1.Range("C3").Copy ws2.Range("C" & DestRow)
    ws1.Range("D3").Copy ws2.Range("D" & DestRow)
    ws1.Range("E3").Copy ws2.Range("E" & DestRow)
    ws1.Range("F3").Copy ws2.Range("F" & DestRow)
    ws1.Range("D19").Copy ws2.Range("G" & DestRow)
    ws1.Range("E19").Copy ws2.Range("H" & DestRow)
    ws1.Range("F19").Copy ws2.Range("I" & DestRow)
End Sub
 
Disregard................................
 
Last edited:
Upvote 0

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Thanks My Answer - This works great as well. I appreciate your time in looking at it. F19 Is a sum total, and when it copies over I loose the amount? Any ideas?

Code:
=SUM(F13+F15+F17-E19)

Try this:

Code:
Sub ButtonCode()
    'Modified  11/27/2018  8:26:42 PM  EST
    Dim ws1 As Worksheet, ws2 As Worksheet
    Dim DestRow As Long
    Set ws1 = Sheets("Cartage Rate")
    Set ws2 = Sheets("Complete")
    DestRow = ws2.Cells(Rows.Count, "B").End(xlUp).Row + 1
    ws1.Range("B3:F3").Copy ws2.Range("B" & DestRow)
    ws1.Range("D19:F19").Copy
    ws2.Range("G" & DestRow).PasteSpecial Paste:=xlPasteValues
    End Sub
 
Upvote 0
Thank you for that BAI, this will work for me.


Try this:

Code:
Sub ButtonCode()
    'Modified  11/27/2018  8:26:42 PM  EST
    Dim ws1 As Worksheet, ws2 As Worksheet
    Dim DestRow As Long
    Set ws1 = Sheets("Cartage Rate")
    Set ws2 = Sheets("Complete")
    DestRow = ws2.Cells(Rows.Count, "B").End(xlUp).Row + 1
    ws1.Range("B3:F3").Copy ws2.Range("B" & DestRow)
    ws1.Range("D19:F19").Copy
    ws2.Range("G" & DestRow).PasteSpecial Paste:=xlPasteValues
    End Sub
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,906
Members
452,366
Latest member
TePunaBloke

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