comicwizard
New Member
- Joined
- Jun 15, 2011
- Messages
- 2
I want to click on a cell and have the color change. There is a cell range I want this to be in and not the whole work sheet.
I have some code which was given to me but doesn't include a range. and I want a different color but having a hard time finding the color codes.
If I could have different coding that would be great. thanks
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Selection.Interior.ColorIndex = xlNone Then
With Selection.Interior
.ColorIndex = 43
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Else
Selection.Interior.ColorIndex = xlNone
End If
End Sub
I have some code which was given to me but doesn't include a range. and I want a different color but having a hard time finding the color codes.
If I could have different coding that would be great. thanks
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Selection.Interior.ColorIndex = xlNone Then
With Selection.Interior
.ColorIndex = 43
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Else
Selection.Interior.ColorIndex = xlNone
End If
End Sub