I used a string array to fill the required number. Also they would be displayed in the Immediate Window. Any questions, please comment
Private Sub Command1_Click()
Dim p_str As String, p_Num(1 To 3) As String, i As Integer, p_intStart As Integer
p_str = ",080800 - Anthelmintics,081202 - Aminoglycosides,081204 - Antifungal Antibiotics"
p_intStart = InStr(1, p_str, ",")
For i = 1 To 3
p_Num(i) = Trim(Mid(p_str, InStr(p_intStart, p_str, ",") + 1, InStr(InStr(p_intStart, p_str, ","), p_str, "-") - InStr(p_intStart, p_str, ",") - 1))
p_intStart = InStr(InStr(p_intStart, p_str, ","), p_str, "-")
Debug.Print p_Num(i)
Next i
End Sub
0
Question has a verified solution.
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Private Sub Command1_Click()
Dim strVal As String
strVal = ",080800 - Anthelmintics,081202 - Aminoglycosides,081204 - Antifungal Antibiotics"
startval = 1
While InStr(startval, strVal, ",")
MsgBox Mid(strVal, InStr(startval, strVal, ",") + 1, 6)
startval = InStr(startval, strVal, ",") + 1
Wend
End Sub