LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 17
Default Conditional formating

Thanks Dave,
This worked perfectly.

Yogin

"Dave Peterson" wrote:

Just add a line:

Select Case .Value
Case "LEX": .Interior.ColorIndex = 3 'red
Case "LIN": .Interior.ColorIndex = 6 'yellow
Case Else: .Interior.ColorIndex = xlNone
End Select



Yogin wrote:

Hi i'm using the code below for conditional formating, this work fine but is
there a code where if I chose a criteria which is not in the code to change
the colour to default (white). Currently I am using validation box and has
upto 16 different criteria, if I type in LEX, this changes the cell colour to
Red, but if i change the same cell value to LL, the cell colour is still Red
and not white.

Can you anyone help me please.

Private Sub Worksheet_Change(ByVal Target As Range)

Const WS_RANGE As String = "G7:HC600"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
Select Case .Value
Case "LEX": .Interior.ColorIndex = 3 'red
Case "LIN": .Interior.ColorIndex = 6 'yellow

End Select
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub

Thanks

Yogin


--

Dave Peterson

 
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 Formating Vicky Excel Discussion (Misc queries) 2 August 15th 07 02:12 PM
Conditional formating Dave Excel Worksheet Functions 2 June 18th 07 02:51 PM
Conditional formating a row bgl Excel Worksheet Functions 1 August 10th 06 04:09 PM
Conditional Formating Dan Excel Worksheet Functions 0 March 26th 06 11:45 PM
Install dates formating using conditional formating? Jerry Eggleston Excel Discussion (Misc queries) 2 November 9th 05 05:49 PM


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