Hi,
Assume I have a dropdown by name : Module:drp:B5.
I need to split this string and get the value as B.Kindly provide some suggestions to i arrive at a solution for this problem.
Regards
Vidya
Hi,
Assume I have a dropdown by name : Module:drp:B5.
I need to split this string and get the value as B.Kindly provide some suggestions to i arrive at a solution for this problem.
Regards
Vidya
It's ugly but this works:
Returns the first character after the third :left(right(": Module:drp:B5",len(": Module:drp:B5")-instr(instr(instr(1,": Module:drp:B5",":")+1,": Module:drp:B5",":")+1,": Module:drp:B5",":")),1)
Last edited by Aussiebear; 04-13-2023 at 12:31 PM. Reason: Adjusted the code tags
This is a much more elegant way of doing it and it doesn't matter how many : you have:
Sub SplitString() Dim MyArr As Variant Dim MyString As String Dim MyNewString As String MyString = ": Module:drp:B5" MyArr = Split(MyString, ":") MyNewString = Left(MyArr(UBound(MyArr)), 1) msgbox MyNewString End Sub
Last edited by Aussiebear; 04-13-2023 at 12:32 PM. Reason: Adjusted the code tags
Hi,
Thanks a lot. It worked perfectly.
Regards
Vidya