[Solved] Split string in array not in cell range vba


Do like this.

Sub test()
    Dim vDB, vR()
    Dim i As Long, n As Long
    Dim s As String
    vDB = Range("g1", Range("g" & Rows.Count).End(xlUp))
    n = UBound(vDB, 1)
    ReDim vR(1 To n, 1 To 2)

    For i = 1 To n
        s = vDB(i, 1)
        vR(i, 1) = Split(s, "https://stackoverflow.com/")(1)
        vR(i, 2) = Split(s, "X")(1)
    Next i
    Range("h1").Resize(n, 2) = vR

End Sub

9

solved Split string in array not in cell range vba