I have a string like this ABC$3$FG$H
and I want to split them into 4 different strings.
string1 - ABC, Number-3, string3-FG, String4 - H.
I am splitting the string with $ sign in the actual string.
Split(String1,"$")
Quite enough. Returns a zero-based, one-dimensional array containing a specified number of substrings.
If you want to look through the splitted string, this is a possible solution:
Public Sub TestMe()
Dim str As String
Dim cnt As Long
str = "ABC$3$FG$H"
For cnt = LBound(Split(str, "$")) To UBound(Split(str, "$"))
Debug.Print Split(str, "$")(cnt)
Next cnt
End Sub
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.