Object Required Error when running Macro

Donal28

Well-known Member
Joined
Apr 23, 2010
Messages
527
Hi There

I am trying to run the following macro to copy a data range(A1:HX1) range from one sheet(sheet 6) and past it into the next available blank row in another sheet called New_Overall_Input_File but get the following error when I try and run it......."Object Required"?


Sub ALLCARS()
Sheet6.Range("A1:HX1").Copy
New_Overall_Input_File.Range("D" & Rows.Count).Offset(1, 0).PasteSpecial xlPasteValues
Application.CutCopyMode = False
End Sub

Any Help would be much appreciated

Regards
Donal
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
You'd need to formulate this line as follows:
Worksheets("New_Overall_Input_File").Range("D" & Rows.Count).Offset(1, 0).PasteSpecial xlPasteValues

I'm also unsure whether the line with Sheet6 will work. You are referring to the "codename" as opposed to the sheet name.
 
Upvote 0
"New_Overall_Input_File" is the name of the worksheet where I want the data to be pasted to
 
Upvote 0
You can't offset the last row by one row. Is it?

Worksheets("New_Overall_Input_File").Range("D" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
 
Upvote 0
Yes changed the the 1st line to Worksheets("Sheet6") but still getting error 9 "Subscript Out of Range". The code seems to compile OK
 
Upvote 0
The error comes from referring to sheets that do not exist or beyond the effective range of the cells.

Can you repost your code with the modifications.
 
Upvote 0

Forum statistics

Threads
1,216,095
Messages
6,128,800
Members
449,468
Latest member
AGreen17

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