1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| 'START OF CODE
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim WatchRange As Range
Dim CellVal As String, i as integer
If Target.Cells.Count > 1 Then Exit Sub
If Target = "" Then Exit Sub
CellVal = Target
Set WatchRange = Range("A3:A1000")
If Not Intersect(Target, WatchRange) Is Nothing Then
for i = 1 to len(target.value)
cellval = val(mid(target,i,1))
Select Case CellVal
Case 1
Target.offset(0,i-1).Interior.ColorIndex = 5
Target.offset(0,i-1).Font.ColorIndex = 5
Case 2
Target.offset(0,i-1).Interior.ColorIndex = 10
Target.offset(0,i-1).Font.ColorIndex = 10
Case 3
Target.offset(0,i-1).Interior.ColorIndex = 8
Target.offset(0,i-1).Font.ColorIndex = 8
Case 4
Target.offset(0,i-1).Interior.ColorIndex = 46
Target.offset(0,i-1).Font.ColorIndex = 46
Case 5
Target.offset(0,i-1).Interior.ColorIndex = 45
Target.offset(0,i-1).Font.ColorIndex = 45
Case 6
Target.offset(0,i-1).Interior.ColorIndex = 15
Target.offset(0,i-1).Font.ColorIndex = 15
Case 0
Target.offset(0,i-1).Interior.ColorIndex = 0
Target.offset(0,i-1).Font.ColorIndex = 2
End Select
next i
End If
End Sub
'END OF CODE |
Partager