Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Special Clearcontents (Values Only) 1

Status
Not open for further replies.

vestax22

Programmer
Jun 18, 2003
139
CA
Hi, I use this line of code to erase only the values and not the formulas inside a range :

Worksheets("Months1").Range("months1Inputs").SpecialCells(xlCellTypeConstants).ClearContents

It works great except that when there is no data to erase it crashes. When I do a regular clearcontents It doesn't crash when there is no data to erase. Is there anybody that knows the solution to this problem?

Thx
 
just put
on error resume next
before that line and
On error goto 0
after it (to turn off the resume next for the rest of the sub)

Rgds, Geoff
Quantum materiae materietur marmota monax si marmota monax materiam possit materiari?
Want the best answers to your questions ? faq222-2244
 
Hi
See my reply in your last thread on this subject (thread707-600337). It's a (easily) trappable error!
;-)

If a man says something and there are no women there to hear him, is he still wrong? [ponder]
The faqs ma'am, just the faqs. Get the best from these forums : faq222-2244
 
I don't know. My only posting for about a week and you still have to jump in infront of me!!!!!!!!!!!
;-)

If a man says something and there are no women there to hear him, is he still wrong? [ponder]
The faqs ma'am, just the faqs. Get the best from these forums : faq222-2244
 
sorry Loomah [blush] - I'm not picking on you on purpose :)

Rgds, Geoff
Quantum materiae materietur marmota monax si marmota monax materiam possit materiari?
Want the best answers to your questions ? faq222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top