wie kann ich ein Array mit Kürzel (z.b Es) füllen und dann über eine If abfrage einbinden.
Sprich wenn das Kürzel in der array enthalten ist, dann soll etwas bestimmtes gemacht werden.
For i = 0 To ubound([ArrayName], [Dimension])
If Instr([ArrayName][Index],"Es"]) > 0 Then
Sub tt()
Dim arr, Z
arr = Array("ab", "fr", "es", "ht")
For Each Z In arr
If Z = "es" Then
MsgBox "Ja"
End If
Next
End Sub
Sub tt()
Dim arr, Z
arr = Array("1", "fr", "es", "ht")
For Each Z In arr
If Cells(1, 1).Value = Z Then
MsgBox "Ja"
End If
Next
End Sub
Sub tt()
Dim arr, Z
arr = Array("1", "fr", "es", "ht")
For Each Z In arr
If LCase(Z) = LCase(Cells(1, 1).Value) Then
MsgBox "Ja"
End If
Next
End Sub
Sub DIN_Kürzel()
Dim arr, Z
arr = Array("BS", "BA", "WA", "WS")
lr = Cells(Rows.Count, "A").End(xlUp).Row
For i = 13 To lr
For Each Z In arr
If Cells(i, 1).Value = Z Then
Cells(i, 4).Interior.Color = RGB(255, 255, 255)
Else
'Cells(i, 4).Interior.Color = RGB(255, 0, 0)
End If
Next
Next
End Sub
For Each Z In arr
If Cells(i, 1).Value = Z Then
Cells(i, 4).Interior.Color = RGB(255, 0, 0)
Exit For
Else
Cells(i, 4).Interior.Color = RGB(255, 255, 255)
End If