Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Conditional Formats

How can I test if a selection contains conditional
formats, the following does not work.

" IF Selection.FormatConditions(2) = True Then ""

I am trying to delete FormatCondition (2) within a
selection, but if any cell within that selection does not
have any conditional formats, I get an error. I want to
the code to continue, regardless of the error.

Any Ideas
Alec


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Conditional Formats

On Fri, 17 Oct 2003 02:15:57 -0700, Alec wrote:

How can I test if a selection contains conditional
formats, the following does not work.

" IF Selection.FormatConditions(2) = True Then ""

I am trying to delete FormatCondition (2) within a
selection, but if any cell within that selection does not
have any conditional formats, I get an error. I want to
the code to continue, regardless of the error.

Any Ideas
Alec


That doesn't really involve conditional formatting, but rather
Error-handling.

To disregard error-messages, use to following line in your code:

On Error Resume Next

This makes sure that errors no longer cause a message. You can use the
Err-variable to see what kind of errors you encounter and you can use this
in your code with if-statements or something. Or just disrespect the
error-codes.

Once you do want to receive errors, place the following in your code:

On Error Goto 0

This resets the error-handling to default.

And I think you could also use the following:

"If Selection.FormatConditions.Count 1 then ***CODE***"

This way you trip the if-statement when there are more than 1 conditional
formatting in place...

HTH
CoRrRan
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Conditional Formats

Thanks Corran

It works a treat, you've also helped me out on another
little problem I had.




-----Original Message-----
On Fri, 17 Oct 2003 02:15:57 -0700, Alec wrote:

How can I test if a selection contains conditional
formats, the following does not work.

" IF Selection.FormatConditions(2) = True Then ""

I am trying to delete FormatCondition (2) within a
selection, but if any cell within that selection does

not
have any conditional formats, I get an error. I want to
the code to continue, regardless of the error.

Any Ideas
Alec


That doesn't really involve conditional formatting, but

rather
Error-handling.

To disregard error-messages, use to following line in

your code:

On Error Resume Next

This makes sure that errors no longer cause a message.

You can use the
Err-variable to see what kind of errors you encounter and

you can use this
in your code with if-statements or something. Or just

disrespect the
error-codes.

Once you do want to receive errors, place the following

in your code:

On Error Goto 0

This resets the error-handling to default.

And I think you could also use the following:

"If Selection.FormatConditions.Count 1 then ***CODE***"

This way you trip the if-statement when there are more

than 1 conditional
formatting in place...

HTH
CoRrRan
.

Reply
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
Conditional Formats, how to scroll and view all formats? Bill E Excel Worksheet Functions 0 May 12th 10 07:58 PM
more than 3 conditional formats rory_r Excel Worksheet Functions 2 October 13th 08 09:47 PM
Conditional formats- paste special formats? jcarney Excel Discussion (Misc queries) 1 November 1st 07 06:37 PM
paste conditional formats as formats leo Excel Discussion (Misc queries) 2 July 5th 07 10:06 AM
Conditional Formats RUSH2CROCHET Excel Discussion (Misc queries) 4 June 9th 06 05:52 PM


All times are GMT +1. The time now is 09:48 AM.

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

About Us

"It's about Microsoft Excel"