LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default What's wrong with this code?

If Selection.SpecialCells(xlConstants) Is Nothing Then
Exit Sub
Else
Selection.SpecialCells(xlConstants).ClearContents
End If

Basically, if the cells in question (either a selection or a range) are
already cleared then I do not want the sub run, otherwise I want it run. The
above is not trapping that condition as the last line before End If always
runs and brings up the error 'no cells' - I do not want this error to be
shown, just want the code to terminate in that case.

tia
James
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
What the F@#% is wrong with this code?? Finny[_3_] Excel Programming 8 July 19th 06 04:56 PM
HELP! What's wrong with my code? Sethaholic[_5_] Excel Programming 0 July 11th 05 07:43 PM
HELP! What's wrong with my code? Sethaholic[_6_] Excel Programming 0 July 11th 05 07:37 PM
What's wrong with the code,pls hv a look changeable[_4_] Excel Programming 1 November 3rd 04 02:57 AM
What's wrong with this bit of code Mervyn Thomas Excel Programming 7 January 22nd 04 03:56 PM


All times are GMT +1. The time now is 01:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"