VBA error inserting copied data - why?

KMack22

New Member
Joined
Jul 29, 2010
Messages
2
I am trying to insert copied data from one wksht to another. I have written a macro and when I run it and I am getting error code 1004: cannot shift objects off sheet and don't know why.

Here is my code:

Range("A4").Select
Sheets("Data Entry").Range("A4:AG" & Sheets("Data Entry").Range("A4").End(xlDown).Row).Select
Selection.Copy
Sheets("Historical Data").Select
Rows("4:4").Select

(this line below is the one that stops and highlights the error):
Selection.Insert Shift:=xlDown
Application.CutCopyMode = False

does anyone know why it is doing that?
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
thanks Peter! I read what Microsoft had to say to fix. Ended up going another route though. I inserted the data rather than rows and it worked fine. not sure why, but happy it's fixed.

I hadn't thought to go to Microsoft and type in the exact error - I will do that next time. thanks!
 
Upvote 0

Forum statistics

Threads
1,214,593
Messages
6,120,435
Members
448,962
Latest member
Fenes

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