Code to copy from active worksheet to another workbook next available a cell

Ace71425

Board Regular
Joined
Apr 20, 2015
Messages
130
I need to copy a range A1:D5000 from the active worksheet I have open and open up another workbook paste it to the next availble a cell and then save and close that other workbook. Please let me know if you have the VBA for this as I have tried multiple things to no avail. Thank you!
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Which sheet would it need to go to in the other workbook?
 
Upvote 0
Try this:

Sub copyData1A()
Range("A1:D5000").Copy
Workbooks.Open "Path and workbook name.xlsx" 'Add the path and workbook name here
Sheets("TRACKING SHEETS").Activate
Range("A65536").Select
Selection.End(xlUp).Select
ActiveCell.Offset(1).Paste
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub
 
Upvote 0
I'm having the same problem I was having with some other code I was messing around with it seems solid up to the point where it opens up the other workbook and selects and goes to the TRACKING SHEETS tab perfectly but then it doesnt paste and I get a 400 error
 
Upvote 0
Do you get the same error with the code below?

Code:
Sub copyData1A()
    Range("A1:D5000").Copy
    Workbooks.Open "Path and workbook name.xlsx"    'Add the path and workbook name here
    Sheets("TRACKING SHEETS").Range("A" & Rows.Count).End(xlUp).Offset(1).PasteSpecial

    ActiveWorkbook.Save
    ActiveWorkbook.Close
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,247
Messages
6,171,007
Members
452,374
Latest member
keccles

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