ClearContents problem (SOLVED)

phantom1975

MrExcel MVP
Joined
Jun 3, 2002
Messages
3,962
I have this simple macro:

Sheets("Sheet1").Range("A3:A1000").ClearContents

When I try to run this macro, I get this error message:

Run-time error '1004':

ClearContents method of Range class failed

These are not protected cells, so I have NO idea what the issue is. Any ideas?

_________________
Pass on what you have learned. Support this great website by clicking on the sponsor's ads!.
This message was edited by phantom1975 on 2002-10-11 00:32
 
Some thoughts:

1. How can you have a sheet named "Daily Numbers" that in the Project window is named "Daily Activites"?
2. If you can do it manually, record it. What happens when you run the recorded Macro?

The more I read the more I think this is just a problem with names - Daily Numbers, Daily Activities, Today's Activities - too many Dailies and Activities.
 
Upvote 0

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
The CommandButton was placed directly on the sheet called, "Today's Activities" using the Control Toolbox toolbar. When clicked, it should delete data that is on the "Daily Numbers" sheet.

When I record a macro and change the CommandButton_Click procedure to call the macro, it works fine. When I copy and paste the macro procedure into the CommandButton_Click event and delete the Call Macro1, it fails. It continues to fail at the same point. Selecting the range A3:A1000. I'd really like to know what the heck this might be.
 
Upvote 0
Hi

I think i have gotten this error before. I cannot remember exactly how i fixed it but ...
Here are a few suggestions.

Try this:

Sheets("Daily Numbers").Select
Range("A3:A1000").ClearContents

If that doesn't work the check to see if the sheet is hidden. Try

Sheets.("Daily Numbers").visible=true
Sheets("Daily Numbers").Range"A3:A1000").ClearContents

Excel may not like it if you try to clearcontents on a hidden sheet.

Hope that helps.
I'll see if I can remember how I fixed it.
Let me know if it works.

Krupa
 
Upvote 0
hey,

i just thought of something else. Is the page locked or anything like that?
this could affect you clearing in the code.

hopethishelps,
Krupa
 
Upvote 0
I took Ivan's advice and got changed the property to false. I added ActiveCell.Activate before the clear contents and still no luck.
 
Upvote 0
I moved everything to a new sheet and it did the trick. I've never heard of corrupt worksheets before, but then again, there is a lot I haven't heard of yet! Thanks for all the help.
 
Upvote 0
I got the same problem. Was struggling with it but then debugged through the code and got more detailed message about merged cells being partially in the range I was trying to clear and partially out of the range. So I changed the range to include the merged cells completely and then this error went away. Hope this helps to someone.
 
Upvote 0

Forum statistics

Threads
1,224,802
Messages
6,181,053
Members
453,014
Latest member
Chris258

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