View Full Version : [SOLVED:] Splitting the name of dropdown
vidya lakshm
10-10-2010, 09:25 PM
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
Blade Hunter
10-10-2010, 09:31 PM
It's ugly but this works:
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)
Returns the first character after the third :
Blade Hunter
10-10-2010, 09:35 PM
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
vidya lakshm
10-10-2010, 10:56 PM
Hi,
Thanks a lot. It worked perfectly.
Regards
Vidya
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.