Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I tried using this code, in my Excel spreadsheet, for my worksheet but it is
not working. Could it be that the cells I'm trying to color are merged? Any help would be appreciated. Thank you. Private Sub Worksheet_Change(ByVal Target As Range) Dim WatchRange As Range Dim CellVal As String If Target.Cells.Count 1 Then Exit Sub If Target = "" Then Exit Sub CellVal = Target Set WatchRange = Range("A1:c100") 'change to suit If Not Intersect(Target, WatchRange) Is Nothing Then Select Case CellVal Case "Dog" Target.Interior.ColorIndex = 5 Case "Cat" Target.Interior.ColorIndex = 10 Case "Other" Target.Interior.ColorIndex = 6 Case "Rabbit" Target.Interior.ColorIndex = 46 Case "Goat" Target.Interior.ColorIndex = 45 End Select End If End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VBA Code Colors | Excel Programming | |||
changing bacground colour if formula altered | Excel Programming | |||
Print VBA code in Editor format colors | Excel Programming | |||
VBA code to count colors/shapes? | Excel Programming | |||
how can i select all the cells with same color on a sheet if there are multipale colors by vba code | Charts and Charting in Excel |