error 1004

Giggzz

Well-known Member
Joined
Jul 4, 2002
Messages
990
Private Sub CommandButton1_Click()
Range("B4:D4,J4,B5:E5,G5:H5,J5,B6,E6:G6,I6,C7:D7,F7:G7,B9:E9,I9:J9,B10:E10,G10:H10,J10,B11,E11:F11,H11:I11,B12:C12,E12,C14:E14,G14:H14,J14,B15,B17,E17,G17:H17,B19,E19,G19:H19,J19,A23:H23,A24:H24,A25:H25,a26:b26,B34:F34,B35:F35,C47:J47,A48:J48,C49:J49,A50:J50,J53,J54").ClearContents
End Sub

getting an error - Run-Time errror 1004 Application-defined or Object-defined error.

Any idea what might fix it??? Thanks
 

Some videos you may like

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

DRJ

MrExcel MVP
Joined
Feb 17, 2002
Messages
3,853
It looks like there are too many seperate ranges. It works when you split up this code.

Range("B4:D4,J4,B5:E5,G5:H5,J5,B6,E6:G6,I6,C7:D7,F7:G7,B9:E9,I9:J9,B10:E10,G10:H10,J10,B11,E11:F11,H11:I11,B12:C12,E12,C14:E14").ClearContents
Range("G14:H14,J14,B15,B17,E17,G17:H17,B19,E19,G19:H19,J19,A23:H23,A24:H24,A25:H25,a26:b26,B34:F34,B35:F35,C47:J47,A48:J48,C49:J49,A50:J50,J53,J54").ClearContents
 

Giggzz

Well-known Member
Joined
Jul 4, 2002
Messages
990
now getting metod range of object_worksheet failed. ???????
 

DRJ

MrExcel MVP
Joined
Feb 17, 2002
Messages
3,853
I just cut and pasted what I posted above and it works for me.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,575
Messages
5,596,955
Members
414,114
Latest member
Lost_User21

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
Top