Pasting to last row

WxShady13

Board Regular
Joined
Jul 24, 2018
Messages
185
Office Version
  1. 365
Platform
  1. Windows
  2. Mobile
I am working on a spreadsheet that after the user inputs data they run a macro that writes to a table so we can pull historical data into a chart. What I cannot get is the pasted data to begin at the first blank row of the historical table. I cannot figure what I am doing wrong, thank you for the help.

Code:
Sub ArchiveProjects_Chart()
Application.ScreenUpdating = False
Worksheets("Pivot Data").Range("P2:R7").Copy
Worksheets("Chart Data").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
Application.ScreenUpdating = True

End Sub
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
I tested and it worked perfectly. If I put data in A14, it pastes in A15 (of course if you habe something in B19, it does not consider it, it checks column A) the Range P2:R7 of the other sheet. It works whatever the ative sheet is, no problem with your code!

It also work if P2:R7 is pivottable
 
Last edited:
Upvote 0
Thank you for testing, I will see why it isn't working on my sheets.
 
Upvote 0
Well to update you on what I have discovered....For some reason it would not write to the Chart Data worksheet at all, however when I created a new worksheet and changed the code to point there it works flawlessly. Thank you for your help
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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