untenstehend folgender Code:
Private Sub Worksheet_Calculate1()
Dim RaBereich As Range ' Variable für Bereich
Dim RaZelle As Range ' Variable für Zelle
' Bereich der Wirksamkeit
Set RaBereich = Range("F20")
For Each RaZelle In RaBereich ' überwachten Bereich formatieren
With RaZelle
Select Case .Value ' Zellinhalt vergleichen
Case Is = ""
.Interior.ColorIndex = 0 ' Füllfarbe leer
.Font.ColorIndex = 1 ' Schriftfarbe Schwarz
Case Is = Range("W20").Value
.Interior.ColorIndex = 4 ' Füllfarbe Hellgrün
.Font.ColorIndex = 1 ' Schriftfarbe Schwarz
Case Is = "0"
.Interior.ColorIndex = 4 ' Füllfarbe Hellgrün
.Font.ColorIndex = 1 ' Schriftfarbe Schwarz
Case Else
.Interior.ColorIndex = 0 ' Füllfarbe leer
.Font.ColorIndex = 1 ' Schriftfarbe Schwarz
End Select
End With
Next RaZelle
Set RaBereich = Nothing ' Variable leeren
End Sub
Ich möchte diese Formel über 300 Zeilen durchführen und die zwei Variablen...
Set RaBereich = Range("F20")
Case Is = Range("W20").Value
... sollen jeweils mit der nächsten Zeile mitspringen.
Zum Beispiel:
Zeile 1: Set RaBereich = Range("F20")
Case Is = Range("W20").Value
Zeile 2: Set RaBereich = Range("F21")
Case Is = Range("W21").Value
und das über 300 Zeilen.
Vielen Dank schon mal für Eure Hilfe.
Schöne Grüße
Lukas