wie kann ich bitte per VBA die letzte benutzte Splate in der Zeile 10 ermitteln?
Bedingung: Der Zellwert muss ein Zahl sein oder Schriftfarbe rot haben.
Gruß,
Sergej
Sub Makro1()
Dim letzteSpalte As Long, i As Long
With ActiveSheet
letzteSpalte = .Cells(10, Columns.Count).End(xlToLeft).Column
For i = letzteSpalte To 1 Step -1
If IsNumeric(.Cells(10, i)) Or .Cells(10, i).Font.Color = vbRed Then Exit For
Next i
End With
MsgBox i
End Sub
Sub Makro2()
Dim letzteSpalte As Long, i As Long
With ActiveSheet
letzteSpalte = .Cells(10, Columns.Count).End(xlToLeft).Column
For i = 1 To letzteSpalte
If IsNumeric(.Cells(10, i)) Or .Cells(10, i).Font.Color = vbRed Then Exit For
Next i
End With
MsgBox i
End Sub
Sub Makro2()
Dim letzteSpalte As Long, i As Long
With ActiveSheet
letzteSpalte = .Cells(10, Columns.Count).End(xlToLeft).Column
For i = 1 To letzteSpalte
If Not .Cells(10, i) = "" And _
(IsNumeric(.Cells(10, i)) Or .Cells(10, i).Font.Color = vbRed) Then Exit For
Next i
End With
MsgBox i
End Sub