Suggestions to paste new data on last row....

knightwriter

New Member
Joined
Jul 4, 2016
Messages
17
Hi all,

The macro I run extracts data from multiple workbooks and I have set different ranges from where to copy & paste this data into one data sheet.

Issue I am having is that when I run the macro it replaces the data from previous extract in my data dump sheet. Is there a way I can keep the previous data and put the next data extract on the last row?

I have used: last_row = Cells(Rows.Count, "A").End(xlUp).Row
Range("A1").Copy Destination:=Cells(last_row + 1, "A")

but this does not recognize where the first workbook needs to start pasting values, its just takes the cell from A1.

All help much appreciated
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Looks like its to do with you not qualifying your sheets. Which sheet are you in when the macro is run? Which sheet is the data to be pasted in?
 
Upvote 0
I go from an "instructions" tab where the specific source workbooks are listed and want it to paste to a "extracted data" tab.
 
Upvote 0
You need to qualify them sheets. You cant just use cells or excel will use the activesheet at the time. That may or may not lead to the correct number. Like this for example:

Code:
Set sh1 = Sheets("Sheet1")
Set sh2 = Sheets("Sheet2")

last_row = sh1.Cells(Rows.Count, "A").End(xlUp).Row
sh2.Range("A1").Copy Destination:=sh1.Cells(last_row + 1, "A")
 
Upvote 0

Forum statistics

Threads
1,215,016
Messages
6,122,700
Members
449,092
Latest member
snoom82

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