1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| Sub ext_STRorCOL()
Dim code As String
Dim maturity As String
Dim instrum As String
Dim tenor As String
Dim Last As String
Dim pos1 As Integer
Dim pos2 As Integer
Dim pos3 As Integer
code = "100m10y 20ws @123"
pos1 = InStr(code, "m")
maturity = Left(code, pos1)
pos2 = InStr(pos1 + 1, code, "y")
tenor = Trim(Mid(code, pos1 + 1, pos2 - pos1))
pos3 = InStr(pos2 + 1, code, "wc") Or InStr(pos2 + 1, code, "ws")
instrum = Mid(code, pos2 + 1, pos3 - pos2 + 1)
pos1 = InStr(code, "@")
Last = Mid(code, pos1 + 1)
MsgBox "Maturite :" & maturity & vbLf & vbLf & " Tenor :" & tenor & vbLf & vbLf & "Instrument :" & instrum & vbLf & vbLf & "Last :" & Last
End Sub |