ich muß leider schon wieder um Hilfe bitten. Gestern habe ich hier von Ransi diesen Code bekommen, der auch wunderbar funktioniert.
Set acde_C = Range("C3183:C3217")
Set b_C = Range("C3218:C3237")
Set gy_C = Range("C3238:C3252")
Set ur_C = Range("C3253:C3267")
Set or_C = Range("C3268:C3282")
For Each Zelle In Range("C1606:C1746")
If WorksheetFunction.CountIf(acde_C, Zelle) > 0 Then Zelle.Font.ColorIndex = 1
If WorksheetFunction.CountIf(b_C, Zelle) > 0 Then Zelle.Font.ColorIndex = 3
If WorksheetFunction.CountIf(gy_C, Zelle) > 0 Then Zelle.Font.ColorIndex = 5
If WorksheetFunction.CountIf(ur_C, Zelle) > 0 Then Zelle.Font.ColorIndex = 7
If WorksheetFunction.CountIf(or_C, Zelle) > 0 Then Zelle.Font.ColorIndex = 10
Next
Nun möchte ich das Ganze in den daneben liegenden Spalten bis zur Spalte BF wiederholen.
Also
Set acde_D = Range("D3183:D3217")
Set b_D = Range("D3218:D3237")
Set gy_D = Range("D3238:D3252")
Set ur_D = Range("D3253:D3267")
Set or_D = Range("D3268:D3282")
For Each Zelle In Range("D1606:D1746")
If WorksheetFunction.CountIf(acde_D, Zelle) > 0 Then Zelle.Font.ColorIndex = 1
If WorksheetFunction.CountIf(b_D, Zelle) > 0 Then Zelle.Font.ColorIndex = 3
If WorksheetFunction.CountIf(gy_D, Zelle) > 0 Then Zelle.Font.ColorIndex = 5
If WorksheetFunction.CountIf(ur_D, Zelle) > 0 Then Zelle.Font.ColorIndex = 7
If WorksheetFunction.CountIf(or_D, Zelle) > 0 Then Zelle.Font.ColorIndex = 10
Next
Set acde_E = Range("E3183:E3217")
Set b_E = Range("E3218:E3237")
Set gy_E = Range("E3238:E3252")
Set ur_E = Range("E3253:E3267")
Set or_E = Range("E3268:E3282")
For Each Zelle In Range("E1606:E1746")
If WorksheetFunction.CountIf(acde_E, Zelle) > 0 Then Zelle.Font.ColorIndex = 1
If WorksheetFunction.CountIf(b_E, Zelle) > 0 Then Zelle.Font.ColorIndex = 3
If WorksheetFunction.CountIf(gy_E, Zelle) > 0 Then Zelle.Font.ColorIndex = 5
If WorksheetFunction.CountIf(ur_E, Zelle) > 0 Then Zelle.Font.ColorIndex = 7
If WorksheetFunction.CountIf(or_E, Zelle) > 0 Then Zelle.Font.ColorIndex = 10
Next
USW.
Gibt es irgendeine Möglichkeit, das Ganze automatisch auch über die anderen Spalten laufen zu lassen? Z.B. mit so einer Art Schleife. Das Ganze bis zur Spalte BF immer wieder von Hand zu kopieren und entsprechend anzupassen ist nicht nur extrem aufwendig, sondern braucht auch sehr viel Rechnerleistung.
Hoffentlich weiß jemand Rat. Meine VBA Kenntnisse entsprechen leider noch dem Vorschulalter.
MfG
Sabine