View Single Post
 
Old 04-23-2018, 04:22 PM
NoSparks NoSparks is offline Windows 7 64bit Office 2010 64bit
Excel Hobbyist
 
Join Date: Nov 2013
Location: British Columbia, Canada
Posts: 842
NoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of lightNoSparks is a glorious beacon of light
Default

Assuming the sample string is in A1
Code:
Sub GetStates()
    Dim str As String, i As Integer
    Dim ar As Variant, arr As Variant
    
    str = Range("A1").Text
    str = Replace(Replace(Replace(Replace(Replace(str, "}", ""), "[", ""), "]", ""), """", ""), ",", "")
    ar = Split(str, "{")
    For i = LBound(ar) To UBound(ar)
        If InStr(ar(i), "state") > 0 Then
            arr = Split(ar(i), ":")
            MsgBox arr(UBound(arr))
        End If
    Next i
End Sub
Reply With Quote