S
Simon Lloyd
Hi all,
I have tried to devise some code so that if a cell in a set rang
contains a value or character of any kind to change to a colour, i
works but seems to loop many times until my machine freezes (i ca
press escape to get out of it!) any ideas why and perhaps a nudge i
the right direction please!
Thanks,
Simon.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim mycell
Dim rng As Range
Set rng = Range("V2:V40")
For Each mycell In rng
If mycell <> "" Then
mycell.Select
With Selection.Interior
.ColorIndex = 44
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
End If
Next
End Su
I have tried to devise some code so that if a cell in a set rang
contains a value or character of any kind to change to a colour, i
works but seems to loop many times until my machine freezes (i ca
press escape to get out of it!) any ideas why and perhaps a nudge i
the right direction please!
Thanks,
Simon.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim mycell
Dim rng As Range
Set rng = Range("V2:V40")
For Each mycell In rng
If mycell <> "" Then
mycell.Select
With Selection.Interior
.ColorIndex = 44
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With
End If
Next
End Su