Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
As the conditional formating command allows only 3 formats, is it possible to
have more than 3 conditional formats using cod? e.g. cell a1 would display red background if cell a2 = a cell a1 would display underlined text if cell a3 = b cell a1 would display bold text if cell a4 = c cell a1 would display bold italic text if cell a5 = d etc. Thanks in advance of any help John |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "A2:A5" '<== change to suit On Error GoTo ws_exit: Application.EnableEvents = False If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then With Target Select Case .Address(False, False) Case "A2": If .Value = "a" Then Me.Range("A1").Interior.ColorIndex = 3 'red Else Me.Range("A1").Interior.ColorIndex = xlColorIndexNone End If Case "A3": Me.Range("A1").Font.Underline = .Value = "b" Case "A4": Me.Range("A1").Font.Bold = .Value = "c" Case "A5": Me.Range("A1").Font.Bold = .Value = "d" Me.Range("A1").Font.Italic = .Value = "d" End Select End With End If ws_exit: Application.EnableEvents = True End Sub 'This is worksheet event code, which means that it needs to be 'placed in the appropriate worksheet code module, not a standard 'code module. To do this, right-click on the sheet tab, select 'the View Code option from the menu, and paste the code in. -- HTH Bob Phillips (replace xxxx in the email address with gmail if mailing direct) "John Davies" wrote in message ... As the conditional formating command allows only 3 formats, is it possible to have more than 3 conditional formats using cod? e.g. cell a1 would display red background if cell a2 = a cell a1 would display underlined text if cell a3 = b cell a1 would display bold text if cell a4 = c cell a1 would display bold italic text if cell a5 = d etc. Thanks in advance of any help John |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Drop Down lists and condtional formating | Excel Worksheet Functions | |||
conditional formating greater than | Excel Discussion (Misc queries) | |||
Condtional Formating | Excel Worksheet Functions | |||
Conditional Formating if Greater Than or Less Than other column | Excel Worksheet Functions | |||
Condtional formating -- any wildcard use? | Excel Discussion (Misc queries) |