Associate
- Joined
- 13 Nov 2004
- Posts
- 207
- Location
- Newcastle upon Tyne
I have a spreadsheet that uses VBA to change cell colours depending on the value in them. The possible value that can be entered into these cells are picked up from a validation range and selected from drop down list boxes.
The code works fine for everything excpet when deleting from multiple cells at once. Eg, if I delete from cell C8 the value disapears and the cell colour returns to no fill. However, if I select cells C8 & C9, hit delete I get the following error:
Runtime error 13
Type mismatch.
Here is the code for you all to have a peek at.
Many thanks in advance for any help

The code works fine for everything excpet when deleting from multiple cells at once. Eg, if I delete from cell C8 the value disapears and the cell colour returns to no fill. However, if I select cells C8 & C9, hit delete I get the following error:
Runtime error 13
Type mismatch.
Here is the code for you all to have a peek at.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim iColour As Integer
'January
If Not Intersect(Target, Range("rJan")) Is Nothing Then
Call colourCell(Target)
End If
End Sub
Public Sub colourCell(Target)
Select Case Target
Case "BH"
iColour = 6 'Yellow: Bank Holiday
Case "BW"
iColour = 46 'Orange: Bank Holiday Working
Case "H"
iColour = 39 'Lavender: Holiday Lieu Day
Case "S"
iColour = 38 'Rose: Sick
Case "OO"
iColour = 35 'Light Green: Out of The Office
Case "TO"
iColour = 7 'Pink: Time Owed
Case "TB"
iColour = 5 'Blue: Time Bank
Case Else
'Whatever
End Select
Target.Interior.ColorIndex = iColour
End Sub
Many thanks in advance for any help

