Recording a Macro that Copies & Pastes into Other Sheets

carrieebacon

New Member
Joined
Jan 15, 2024
Messages
47
Office Version
  1. 365
Platform
  1. Windows
Hi! I am trying to record a macro that will copy column A through column J from Sheet 1 and paste into column A through column J in Sheet 2. The problem is, I have frozen Row 1 through Row 5 and need the data to paste into Row 6. It will not let me paste into a specific cell, only a column. The data that will be copied and pasted is coming from imported csv files that will differ in length, so some might have 20 rows and others might have 50. That is why I chose to copy columns. (BTW, I figured out how to do it while messing around with it, then once I went to record the macro, I completely forgot how I did it so I know it's possible lol.) Also, is there anything I can set up so that when I run the macro, future data that will be copied and pasted will go to the last row underneath existing data? Thank you!!
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
try this

VBA Code:
Sub CopyDataToSheet2()
    Dim ws1 As Worksheet
    Dim ws2 As Worksheet
    Dim lastRow As Long

    Set ws1 = ThisWorkbook.Sheets("Sheet1")
    Set ws2 = ThisWorkbook.Sheets("Sheet2")

    lastRow = ws2.Cells(ws2.Rows.Count, "A").End(xlUp).Row

    ws1.Range("A1:J100").Copy ws2.Cells(lastRow + 1, 1)
End Sub
 
Upvote 0
Solution

Forum statistics

Threads
1,215,073
Messages
6,122,975
Members
449,095
Latest member
Mr Hughes

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