Hi,
I needed to be able to have 6 conditional formats and so I found some VBA code on the net to help me achieve this and it works ok, the code is shown below
However, i do have an issue if a user inserts a new row within the range as i get an
Run-time error '13' :
Type Mismatch
could someone explain to me how I can stop this happening please if at all possible
Regards
Paul
I needed to be able to have 6 conditional formats and so I found some VBA code on the net to help me achieve this and it works ok, the code is shown below
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim icolor As Integer
Dim ifont As Integer
If Not Intersect(Target, Range("I5:I300")) Is Nothing Then
Select Case Target
Case 0
icolor = 1
ifont = 2
Case 1
icolor = 33
ifont = 1
Case 2
icolor = 4
ifont = 1
Case 3
icolor = 6
ifont = 1
Case 4
icolor = 46
ifont = 1
Case 5
icolor = 3
Case 6
icolor = 13
ifont = 2
End Select
Target.Interior.ColorIndex = icolor
Target.Font.ColorIndex = ifont
End If
End Sub
However, i do have an issue if a user inserts a new row within the range as i get an
Run-time error '13' :
Type Mismatch
could someone explain to me how I can stop this happening please if at all possible
Regards
Paul