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: 2
Default Conditional Formatting using VBA Case...

I have a need for conditional formatting based on greater than 6 conditions
and have found VBA programming on http://www.ozgrid.com/V (*thank you very
much!*) and modified it slightly. It works perfectly for the data manually
entered in the cells in the Target Range. However, I am trying to use the
same conditional formatting on a calculated cell in the Target Range and I
can't get it to work the way I want. The calculated cell will turn the
color defined in the Case statement the first time it is calculated but then
it stays that color and will not reflect the defined color for the the Case
statement.

The data in the Target Range are percentages and here is the modified code
(row 16 cells are =Average(B3:B16), etc. and will not change color per the
case statement)

Private Sub Worksheet_Change(ByVal Target As Range)
Dim icolor As Integer

If Not Intersect(Target, Range("B3:P16")) Is Nothing Then
Select Case Target
Case 0 To 0.0001
iscolor = 2
Case 0.0001 To 0.2499
icolor = 3
Case 0.25 To 0.4999
icolor = 7
Case 0.5 To 0.6499
icolor = 6
Case 0.65 To 0.7499
icolor = 8
Case 0.75 To 1#
icolor = 4
Case Else
icolor = 2

End Select

Target.Interior.ColorIndex = icolor
End If

End Sub

Thanks, Tonly


 
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 formatting - case sensitive text Ron Excel Worksheet Functions 3 May 1st 09 04:01 AM
Conditional Formatting based on Upper case cs_vision Excel Worksheet Functions 5 April 28th 06 08:37 PM
case sensitive conditional formatting Tel Excel Worksheet Functions 3 March 22nd 06 05:02 PM
Select Case Conditional Formatting Sub? RCW Excel Discussion (Misc queries) 2 February 5th 05 10:29 PM
Select Case for Conditional Formatting RonS Excel Programming 3 January 12th 04 05:58 PM


All times are GMT +1. The time now is 02:43 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"