Sub
ergänzen()
Dim
text
As
String
Dim
temp, temp2, temp3, neu
Dim
buchstaben
As
Long
Dim
bst
As
String
Dim
i
As
Long
, j
As
Long
, k
As
Long
text =
"no untagged A3,A7,A9-A10,A14,A16,A18,B5,B19-B20"
temp = Split(text,
","
)
For
i = 0
To
UBound(temp)
temp2 = Split(temp(i),
" "
)
If
InStr(1, temp2(UBound(temp2)),
"-"
) <> 0
Then
temp3 = Split(temp2(UBound(temp2)),
"-"
)
buchstaben = 0
For
j = 1
To
Len(temp3(0))
If
Not
IsNumeric(Mid(temp3(0), j, 1))
Then
buchstaben = buchstaben + 1
Next
j
If
IsNumeric(Right(temp3(0), Len(temp3(0)) - buchstaben))
And
IsNumeric(Right(temp3(1), Len(temp3(1)) - buchstaben))
Then
bst =
""
bst = Left(temp3(0), buchstaben)
neu =
""
For
k = Right(temp3(0), Len(temp3(0)) - buchstaben)
To
Right(temp3(1), Len(temp3(1)) - buchstaben)
neu = neu & bst & k &
","
Next
k
temp2(UBound(temp2)) = Left(neu, Len(neu) - 1)
End
If
temp(i) = Join(temp2,
" "
)
End
If
Next
i
text = Join(temp,
","
)
MsgBox text
End
Sub