LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
BC BC is offline
external usenet poster
 
Posts: 26
Default Conditional Formatting Code Problems

Hi,

I have two columns in my worksheet which are used as lookup input
parameters. A results column is populated with the value returned from this
look up. The cells of the result column will change color based on the value
returned from the lookup. I have used the code shown below to acheive this.
This works perfectly when the look up is performed for the first time.
However, if a user changes one of the parameters in the worksheet, the lookup
will be performed - the correct value is returned to the results column but
the color does not change. Does anyone know how I can get the color to change
dynamically - i'm sure its some flaw in my code.

Thanks a lot guys

BC

Conditional Formatting Code:

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

If Not Intersect(Target, Range("Table")) Is Nothing Then
Select Case Target(1, 1)
Case 1 To 5
icolor = 5
Case 6 To 10
icolor = 6
Case 11 To 15
icolor = 46
Case 16 To 20
icolor = 3
Case 21 To 25
icolor = 13
Case Else
'Whatever
End Select

Target.Interior.ColorIndex = icolor
End If

End Sub




 
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
Problems with Conditional Formatting in Excel 2007 Chuck W[_2_] Excel Discussion (Misc queries) 0 September 25th 09 02:17 PM
Conditional Formatting using code Ayo Excel Discussion (Misc queries) 5 February 29th 08 01:09 PM
Problems with conditional formatting BC Excel Programming 1 November 16th 06 05:05 PM
Conditional Formatting using VBA Code andibevan Excel Programming 2 July 9th 04 04:43 PM


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