[Solved] Extract One Column in a Table from a CSV Hyperlink to Excel Using VBA [closed]


Sub dataImport()

        Dim wbImport        As Workbook
        Dim wksImport       As Worksheet
        Dim rngFind         As Range

        '/ Open the CSV
        Set wbImport = Workbooks.Open("https://www.cboe.org/publish/restrictionsall/cboerestrictedseries.csv")
        Set wksImport = wbImport.Worksheets(1)

        '/ Remove date stamp
        wksImport.Rows(1).EntireRow.Delete

        '/ Search for OPT_CLASS header
        Set rngFind = wksImport.UsedRange.Cells.Find("OPT_CLASS")

        If Not rngFind Is Nothing Then
            '/ Found it
            '/ Copy and paste to column A in Sheet1 of your macro workbook
            rngFind.Resize(rngFind.End(xlDown).Row).Copy ThisWorkbook.Worksheets("Sheet1").Cells(1, 1)
            Application.CutCopyMode = False

            '/Close the CSV file
            wbImport.Close False

        Else
            '/ Didn't find it.
            MsgBox "No such header"
        End If

    End Sub

3

solved Extract One Column in a Table from a CSV Hyperlink to Excel Using VBA [closed]