Range("K16:K1555").Select
For Each Zelle In Selection
If Zelle.Value = "" Then Zelle.FormulaR1C1 = _
"=VLOOKUP(VALUE(LEFT(RC[-10],4)),Max_final!C1:C3,3,FALSE)&VLOOKUP(VALUE(MID(RC[-10],5,4)),Max_final!C1:C3,3,FALSE)"
Select Case Zelle
Case Is = "WSDWSD"
Zelle.Font.ColorIndex = 50 ' Schriftfarbe grün
Case Is = "WCSWCS"
Zelle.Font.ColorIndex = 3 ' Schriftfarbe rot
Case Is = "WSDWCS"
Zelle.Interior.ColorIndex = 22 ' Hintergrund rosa
Case Is = "WCSWSD"
Zelle.Interior.ColorIndex = 22 ' Hintergrund rosa
Case Is = "AGWSD"
Zelle.Font.ColorIndex = 25 ' Schriftfarbe blau
Case Is = "WSDAG"
Zelle.Font.ColorIndex = 25 ' Schriftfarbe blau
Case Is = "WCSAG"
Zelle.Font.ColorIndex = 25 ' Schriftfarbe blau
Case Is = "AGWCS"
Zelle.Font.ColorIndex = 25 ' Schriftfarbe blau
Case Else
Zelle.Interior.ColorIndex = xlColorIndexNone
End Select
Range("A16").Select
Next Zelle
End Sub
Versuchs mal so (ohne "set rng=nothing"). Man sieht allerdings bei dir nicht als was "rng" definiert ist. Wenn es icht "as variant", "as range" oder "as objekt" ist, bzw ohne explicite Definition und z.B. "as worksheet" definiert ist, würde der Fehler auftreten.
In dem Codeausschnitt kann ich auch garnicht erkennen wozu du die Variable "rng" überhaupt brauchst, sie auf Nothing zu setzen wird aber in 99% der Fälle eh nicht wirklich nötig sein.
Gruß
Till
Till
|