S
Simon Lloyd
Hi all, i have some code below in the worksheet selection change event
it used to work until i added some code in standard modules, added some
sheets, added a user form and some Auto shape buttons! none of the
listed additions are in the worksheet module, in fact they are all in
standard modules.......any ideas as to why the Selection Change event
now wont fire??
Regards,
Simon
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim mycell As Range
Dim rng As Range
Set rng = Intersect(Range("C:C,E:E,G:G,I:I,K:K,M:M"),
Range("4:48,52:94,100:142,148:190,196:238"))
For Each mycell In rng.Cells
If LCase(mycell.Value) Like LCase("cheryl*") Then
With mycell.Interior
..ColorIndex = 35
..Pattern = xlSolid
..PatternColorIndex = xlAutomatic
End With
mycell.Value = Mid(mycell.Value, Len("cheryl") + 1)
ElseIf LCase(mycell.Value) Like LCase("Emma*") Then
With mycell.Interior
..ColorIndex = 36
..Pattern = xlSolid
..PatternColorIndex = xlAutomatic
End With
mycell.Value = Mid(mycell.Value, Len("emma") + 1)
ElseIf LCase(mycell.Value) Like LCase("Lauren*") Then
With mycell.Interior
..ColorIndex = 40
..Pattern = xlSolid
..PatternColorIndex = xlAutomatic
End With
mycell.Value = Mid(mycell.Value, Len("lauren") + 1)
ElseIf mycell.Value = "" Then
With mycell.Interior
..ColorIndex = 2
..Pattern = xlSolid
..PatternColorIndex = xlAutomatic
End With
End If
Next mycell
End Sub
it used to work until i added some code in standard modules, added some
sheets, added a user form and some Auto shape buttons! none of the
listed additions are in the worksheet module, in fact they are all in
standard modules.......any ideas as to why the Selection Change event
now wont fire??
Regards,
Simon
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim mycell As Range
Dim rng As Range
Set rng = Intersect(Range("C:C,E:E,G:G,I:I,K:K,M:M"),
Range("4:48,52:94,100:142,148:190,196:238"))
For Each mycell In rng.Cells
If LCase(mycell.Value) Like LCase("cheryl*") Then
With mycell.Interior
..ColorIndex = 35
..Pattern = xlSolid
..PatternColorIndex = xlAutomatic
End With
mycell.Value = Mid(mycell.Value, Len("cheryl") + 1)
ElseIf LCase(mycell.Value) Like LCase("Emma*") Then
With mycell.Interior
..ColorIndex = 36
..Pattern = xlSolid
..PatternColorIndex = xlAutomatic
End With
mycell.Value = Mid(mycell.Value, Len("emma") + 1)
ElseIf LCase(mycell.Value) Like LCase("Lauren*") Then
With mycell.Interior
..ColorIndex = 40
..Pattern = xlSolid
..PatternColorIndex = xlAutomatic
End With
mycell.Value = Mid(mycell.Value, Len("lauren") + 1)
ElseIf mycell.Value = "" Then
With mycell.Interior
..ColorIndex = 2
..Pattern = xlSolid
..PatternColorIndex = xlAutomatic
End With
End If
Next mycell
End Sub