Change cell color index with mouse click
Change cell color index with mouse click
(OP)
I'm trying to tweak the following script to apply only to 1 cell.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("h1").Interior.ColorIndex = xlNone Then
With Range("h1").Interior
.ColorIndex = 43
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Else
With Range("h1").Interior
.ColorIndex = x1None
End With
End If
End Sub
At this point when I click (h1) it changes to green but as soon as I click a different cell (H1) changes back to no color. Any thoughts?
Doug
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Range("h1").Interior.ColorIndex = xlNone Then
With Range("h1").Interior
.ColorIndex = 43
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
Else
With Range("h1").Interior
.ColorIndex = x1None
End With
End If
End Sub
At this point when I click (h1) it changes to green but as soon as I click a different cell (H1) changes back to no color. Any thoughts?
Doug





RE: Change cell color index with mouse click
RE: Change cell color index with mouse click
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$E$9" Then
If Target.Interior.ColorIndex = xlNone Then
Target.Interior.ColorIndex = 43
ElseIf Target.Interior.ColorIndex = 43 Then
Target.Interior.ColorIndex = xlNone
End If
End If
End Sub
RE: Change cell color index with mouse click
CODE -->
RE: Change cell color index with mouse click
Doug
RE: Change cell color index with mouse click
RE: Change cell color index with mouse click