Option
Explicit
Private
Sub
Workbook_Open()
Dim
lngSpaltenZahl
As
Long
With
ThisWorkbook.Sheets(
"Tabelle1"
)
For
lngSpaltenZahl = 2
To
84
If
Application.WorksheetFunction.Count(.Range(.Cells(13, lngSpaltenZahl), .Cells(17, lngSpaltenZahl))) = 0
Then
.Range(.Cells(13, lngSpaltenZahl), .Cells(17, lngSpaltenZahl)).Interior.ColorIndex = 3
Else
.Range(.Cells(13, lngSpaltenZahl), .Cells(17, lngSpaltenZahl)).Interior.ColorIndex = xlNone
End
If
If
Application.WorksheetFunction.Count(.Range(.Cells(32, lngSpaltenZahl), .Cells(37, lngSpaltenZahl))) = 0
Then
.Range(.Cells(32, lngSpaltenZahl), .Cells(37, lngSpaltenZahl)).Interior.ColorIndex = 3
Else
.Range(.Cells(32, lngSpaltenZahl), .Cells(37, lngSpaltenZahl)).Interior.ColorIndex = xlNone
End
If
Next
lngSpaltenZahl
End
With
End
Sub
Private
Sub
Workbook_SheetChange(
ByVal
Sh
As
Object
,
ByVal
Target
As
Range)
Dim
lngSpaltenZahl
As
Long
If
Sh.Name <>
"Tabelle1"
Then
Exit
Sub
With
Sh
If
Target.Row < 13
Or
(Target.Row > 17
And
Target.Row < 32)
Or
Target.Row > 37
Or
Target.Column < 2
Or
Target.Column > 84
Then
Exit
Sub
For
lngSpaltenZahl = 2
To
84
If
Application.WorksheetFunction.Count(.Range(.Cells(13, lngSpaltenZahl), .Cells(17, lngSpaltenZahl))) = 0
Then
.Range(.Cells(13, lngSpaltenZahl), .Cells(17, lngSpaltenZahl)).Interior.ColorIndex = 3
Else
.Range(.Cells(13, lngSpaltenZahl), .Cells(17, lngSpaltenZahl)).Interior.ColorIndex = xlNone
End
If
If
Application.WorksheetFunction.Count(.Range(.Cells(32, lngSpaltenZahl), .Cells(37, lngSpaltenZahl))) = 0
Then
.Range(.Cells(32, lngSpaltenZahl), .Cells(37, lngSpaltenZahl)).Interior.ColorIndex = 3
Else
.Range(.Cells(32, lngSpaltenZahl), .Cells(37, lngSpaltenZahl)).Interior.ColorIndex = xlNone
End
If
Next
lngSpaltenZahl
End
With
End
Sub