ich würde gerne mit VBA die nachfolgenden ziffern auslesen.
$A$2:$L$33
Als Ergebnis brauche ich $A$2 und $L$33 / könnte auch $AB$2 und $AL$33 oder $AB$222 und $AL$3345
Wie mache ich das am geschicktesten?
Gruß / Sonnenpeter
Sub test()
Dim StWert As String
StWert = "$A$2:$L$33"
MsgBox Left(StWert, (InStr(1, StWert, ":") - 1)) & " und " & _
Right(StWert, Len(StWert) - InStr(1, StWert, ":"))
End Sub
Sub AdressenAuslesen()
Dim str As String
Dim strAnfang As String, strEnde As String
str = Selection.Address
If InStr(1, str, ":") = 0 Then
MsgBox "nur eine Zelle ausgewählt!"
Exit Sub
End If
strAnfang = Left(str, InStr(1, str, ":") - 1)
strEnde = Right(str, Len(str) - InStr(1, str, ":"))
MsgBox strAnfang
MsgBox strEnde
End Sub