HERBERS Excel-Forum - das Archiv

Thema: Text getrennt erfassen | Herbers Excel-Forum

Text getrennt erfassen
Gregor

Hallo
Ich habe in einer Zelle folgender möglicher Eintrag:
S7, S15, S16, S26
Wie kann ich aus diesem Eintrag innerhalt eines VBA zuerst die S7 dann die S15 usw. eruieren, damit ich die entsprechenden Shapes mit gleichen Namen selectieren und ändern kann?
In einer Zelle sind 1 bis 5 Einträge, mit Komma getrennt.
Danke und Gruss
Gregor

split(Text,", ")
ransi

HAllo Gregor
Schau dir split() an.
DAmit geht das sehr gut:
Option Explicit



Public Sub machs()
Dim strText As String
Dim vntStr As Variant
Dim I As Integer
strText = "S7, S15, S16, S26"
vntStr = Split(strText, ", ")
For I = LBound(vntStr) To UBound(vntStr)
    MsgBox vntStr(I)
Next
End Sub



ransi
AW: split(Text,", ")
Gregor

Ransi
Super, vielen Dank.
Gregor