any shorter way to get the same result ?
i have a string Series = "C423S539L12332K656GN"
i want to find out the result for C, S, L, K and G
and the result should be
C = 423
S = 539
L = 12332
K = 656
G = N
and here is what i did:
C = Mid(Series, InStr(Series, "C") + 1, InStr(Series, "S") - 2)
S = Mid(Series, InStr(Series, "S") + 1, InStr(Series, "L") - (InStr(Series, "S") + 1))
L = Mid(Series, InStr(Series, "L") + 1, InStr(Series, "K") - (InStr(Series, "L") + 1))
K = Mid(Series, InStr(Series, "K") + 1, InStr(Series, "G") - (InStr(Series, "K") + 1))
G = Right(Series, 1)
my question is do way have any shorter way to get the same result ?
thanks
|