Error 400 in a simple copy and paste between sheets.

Newfs_R_Sublime

Board Regular
Joined
Jan 20, 2011
Messages
99
Range("CC26:EK27").Select
Selection.Copy
Sheets("Sheet2").Select
Range("H1").Select
ActiveSheet.Paste


It crashes on the last two lines. I get a GUI that just says 400. I've seen other issues like this but I can't seem to get this code to work.

Thank you for your time and effort.

Rick
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Try without selecting

Code:
Range("CC26:EK27").Copy Destination:=Sheets("Sheet2").Range("H1")
 
Upvote 0
Andrew's worked, but it just pushed down the error until the next time I tried to copy and paste data. Is there a reason that this is happening?
 
Upvote 0
Where is the code you posted? If it's in the module for a Worksheet try qualifying the Columns property:

Code:
Sheets("Sheet2").Columns("M:N").Select
 
Upvote 0
Yes it is in a macro that was recorded in another workbook and copied over. This worked, but am I going to have to do this with every reference on this sheet?
 
Upvote 0
Only if the code is in a worksheet module. Normally VBA uses the ActiveSheet for unqualified range properties, but it uses the sheet containing the code if it's in a worksheet module.
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,719
Members
452,939
Latest member
WCrawford

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