PC Review


Reply
Thread Tools Rate Thread

Conditional formatting to change ColorIndex?

 
 
=?Utf-8?B?SkBZ?=
Guest
Posts: n/a
 
      28th May 2007
I used conditional format to highlight numbers less than 1. That part works.
The cells containing numbers less than 1 appears to be highlighted, but when
I test its ColorIndex, it still shows -4142, which means its blank. I even
went into FormatCell and the Cell shading section was on None. So what
exactly does Conditional Formatting do to the cell property that changes the
color? Can I get it to change the ColorIndex?
 
Reply With Quote
 
 
 
 
JE McGimpsey
Guest
Posts: n/a
 
      28th May 2007
If the condition is true CF applies the value of the ColorIndex property
of the cell's FormatCondition Object.

CF doesn't (and can't) change the ColorIndex property of the cell's
Interior object.

If you want to know whether CF is applied, test the same condition(s)
set in CF.

In article <9E001E76-E1BF-4181-B651-(E-Mail Removed)>,
J@Y <(E-Mail Removed)> wrote:

> I used conditional format to highlight numbers less than 1. That part works.
> The cells containing numbers less than 1 appears to be highlighted, but when
> I test its ColorIndex, it still shows -4142, which means its blank. I even
> went into FormatCell and the Cell shading section was on None. So what
> exactly does Conditional Formatting do to the cell property that changes the
> color? Can I get it to change the ColorIndex?

 
Reply With Quote
 
=?Utf-8?B?SkxHV2hpeg==?=
Guest
Posts: n/a
 
      28th May 2007
To check the color index of a conditional format, you have to modify the code
a mite.

Sub whatclr()
MsgBox "ColorIndex number is " & Worksheets(1).Cells(4, 3) _
..FormatConditions(1).Interior.ColorIndex
End Sub

Notice the index number after FormatConditions. It can be one of three
depending on which order it was in the original CF setup.

"J@Y" wrote:

> I used conditional format to highlight numbers less than 1. That part works.
> The cells containing numbers less than 1 appears to be highlighted, but when
> I test its ColorIndex, it still shows -4142, which means its blank. I even
> went into FormatCell and the Cell shading section was on None. So what
> exactly does Conditional Formatting do to the cell property that changes the
> color? Can I get it to change the ColorIndex?

 
Reply With Quote
 
=?Utf-8?B?SkxHV2hpeg==?=
Guest
Posts: n/a
 
      28th May 2007
I just noticed your question about changing the ColorIndex for CF. Yes, you
can change it manually and by code. Just use the FormatConditions() property
in the code structure when doing it by code in the same order as my previous
sample.

"J@Y" wrote:

> I used conditional format to highlight numbers less than 1. That part works.
> The cells containing numbers less than 1 appears to be highlighted, but when
> I test its ColorIndex, it still shows -4142, which means its blank. I even
> went into FormatCell and the Cell shading section was on None. So what
> exactly does Conditional Formatting do to the cell property that changes the
> color? Can I get it to change the ColorIndex?

 
Reply With Quote
 
=?Utf-8?B?SkBZ?=
Guest
Posts: n/a
 
      29th May 2007
Great, that solves things. What exactly does the 1 represent int he () after
FormatConditions?

"JLGWhiz" wrote:

> To check the color index of a conditional format, you have to modify the code
> a mite.
>
> Sub whatclr()
> MsgBox "ColorIndex number is " & Worksheets(1).Cells(4, 3) _
> .FormatConditions(1).Interior.ColorIndex
> End Sub
>
> Notice the index number after FormatConditions. It can be one of three
> depending on which order it was in the original CF setup.
>
> "J@Y" wrote:
>
> > I used conditional format to highlight numbers less than 1. That part works.
> > The cells containing numbers less than 1 appears to be highlighted, but when
> > I test its ColorIndex, it still shows -4142, which means its blank. I even
> > went into FormatCell and the Cell shading section was on None. So what
> > exactly does Conditional Formatting do to the cell property that changes the
> > color? Can I get it to change the ColorIndex?

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Colorindex and conditional formatting Libby Microsoft Excel Programming 2 21st Aug 2009 06:46 PM
RE: Conditional Formatting and Interior.ColorIndex Mike H Microsoft Excel Programming 1 28th Mar 2008 05:28 PM
RE: Conditional Formatting and Interior.ColorIndex JLGWhiz Microsoft Excel Programming 0 26th Mar 2008 03:42 AM
Re: Conditional Formatting and Interior.ColorIndex Jim Cone Microsoft Excel Programming 0 26th Mar 2008 12:39 AM
conditional formatting and interior.colorindex =?Utf-8?B?V2F6b29saQ==?= Microsoft Excel Programming 1 24th Feb 2005 05:53 PM


Features
 

Advertising
 

Newsgroups
 


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