Alternative : SplitNoNet()
14.02.2012 11:35:26
NoNet
Hallo Dirk,
da hast Du Recht !
Bevor ich mich jetzt auf die Fehleranalyse in diesem Code begebe, habe ich selbst eine einfache kleine SPLIT()-Funktion nachprogrammiert :
Function SplitNoNet(strText As String, Optional strZ As String = ",")
'Ersatz für SPLIT()-Funktion
'Aufruf : Msgbox UBOUND(SplitNoNet("abc,def,ghi",","))
'oder : MsgBox SplitNoNet("Jan/Feb/Mrz/Apr/Mai/Jun","/")(3)
'14.02.2012, NoNet - www.excelei.de
Dim lngP As Long, strT As String
Dim arrT()
ReDim arrT(0)
strT = strText
While InStr(strT, strZ) > 0
lngP = InStr(strT, strZ)
If lngP > 0 Then
arrT(UBound(arrT)) = Left(strT, lngP - 1)
End If
strT = Mid(strT, lngP + 1, Len(strT) - lngP)
ReDim Preserve arrT(UBound(arrT) + 1)
Wend
arrT(UBound(arrT)) = strT 'letztes Element anhängen
SplitNoNet = arrT
End Function
Mit SPLITNONET("Jan/Feb/Mrz/Apr/Mai/Jun","/")(3) erhält man das Ergebnis "Apr" (Indizierung beginnt Excel-üblich mit 0)
Gruß, NoNet