Daisy_Bumbleroot
New Member
- Joined
- Nov 24, 2004
- Messages
- 35
Why do i get Runtime error =13, type mismatch after running this macro?
Dim colournumber As Integer
Range("C3").Select
Do While ActiveCell.Offset(1, 0) <> ""
If ActiveCell <> "" Then
colournumber = 2
If ActiveCell = "reliability" Then
colournumber = 4
End If
If ActiveCell = "General" Then
colournumber = 6
End If
If ActiveCell = "Safety" Then
colournumber = 3
End If
If ActiveCell = "No Priority Identification" Then
colournumber = 8
End If
ActiveCell.Offset(0, -2).Activate
Selection.Interior.ColorIndex = colournumber
ActiveCell.Offset(0, 1).Activate
Selection.Interior.ColorIndex = colournumber
ActiveCell.Offset(0, 1).Activate
Selection.Interior.ColorIndex = colournumber
ActiveCell.Offset(1, 0).Activate
End If
Loop
End Sub
also, can i activate a RANGE to colour instead of a colouring cell by cell?
Dim colournumber As Integer
Range("C3").Select
Do While ActiveCell.Offset(1, 0) <> ""
If ActiveCell <> "" Then
colournumber = 2
If ActiveCell = "reliability" Then
colournumber = 4
End If
If ActiveCell = "General" Then
colournumber = 6
End If
If ActiveCell = "Safety" Then
colournumber = 3
End If
If ActiveCell = "No Priority Identification" Then
colournumber = 8
End If
ActiveCell.Offset(0, -2).Activate
Selection.Interior.ColorIndex = colournumber
ActiveCell.Offset(0, 1).Activate
Selection.Interior.ColorIndex = colournumber
ActiveCell.Offset(0, 1).Activate
Selection.Interior.ColorIndex = colournumber
ActiveCell.Offset(1, 0).Activate
End If
Loop
End Sub
also, can i activate a RANGE to colour instead of a colouring cell by cell?