ich würde gerne die beliebte OR/ oder funktion von Excel auch in Vba anwenden, in Zusammenhang mit einem If satz.
In Excel könnte ich ja zum beispiel folgenden befehl in einer zelle ausführen:
if(or(a1=0,a2=0,a3=0),"A","B")
nun möchte ich selbige Funktion in einer schleife an der fett gedruckten position verwenden. ich möchte also nicht nur cells(i, 2) auf einen wert hin überprüfen sondern noch weitere.
For i = 1 To 850
If Worksheets("data ").Cells(i, 2).Value = False Then
Worksheets("data ").Cells(i, 16).Font.ColorIndex = 3
ElseIf Left(Sheets("data ").Cells(i, 1), 35) = Left(Sheets("data ").Cells(i, 16), 35) Then
Worksheets("data ").Cells(i, 17).Copy Destination:= _
Worksheets("data ").Cells(i, 1).End(xlToRight).Offset(0, 1)
'if car in column "a" is same (first 35 letters need to be the same) like column "p"
'then copy column "q" values into the next free column of data range
Else
Worksheets("data ").Cells(i, 16).Font.ColorIndex = 3
'if not highlight in red to attract attention
End If
Next i