I've the following code which I use to colour cells when a certain word is inputted.
There is a need to cut and paste or move this info between cells, however when I do so it comes up with an error, (although if I click end it ignores it and works)...any ideas how I can amend?
Private Sub Worksheet_Change(ByVal Target As Range)
Dim icolor As Integer
If Not Intersect(Target, Range("B5:U2082")) Is Nothing Then
Select Case Target
Case "trial"
icolor = 7
Case "Trial"
icolor = 7
Case "tc"
icolor = 28
Case "TC"
icolor = 28
Case "hols"
icolor = 3
Case "Hols"
icolor = 3
Case "sit"
icolor = 4
Case "Sit"
icolor = 4
Case "al"
icolor = 6
Case "AL"
icolor = 6
Case "a/l"
icolor = 6
Case "A/L"
icolor = 6
Case "jmt"
icolor = 39
Case "JMT"
icolor = 39
Case Else
'Whatever
End Select
Target.Interior.ColorIndex = icolor
End If
End Sub
There is a need to cut and paste or move this info between cells, however when I do so it comes up with an error, (although if I click end it ignores it and works)...any ideas how I can amend?
Private Sub Worksheet_Change(ByVal Target As Range)
Dim icolor As Integer
If Not Intersect(Target, Range("B5:U2082")) Is Nothing Then
Select Case Target
Case "trial"
icolor = 7
Case "Trial"
icolor = 7
Case "tc"
icolor = 28
Case "TC"
icolor = 28
Case "hols"
icolor = 3
Case "Hols"
icolor = 3
Case "sit"
icolor = 4
Case "Sit"
icolor = 4
Case "al"
icolor = 6
Case "AL"
icolor = 6
Case "a/l"
icolor = 6
Case "A/L"
icolor = 6
Case "jmt"
icolor = 39
Case "JMT"
icolor = 39
Case Else
'Whatever
End Select
Target.Interior.ColorIndex = icolor
End If
End Sub