Code to import comma Delimited CSV file to a sheet in Excel.

    Sheets.Add(, Sheets(Sheets.Count)).Name = sheetName
    
    Set sheet = Sheets(sheetName)
    
    With sheet.QueryTables.Add(Connection:="TEXT;" & fileLocation, Destination:=sheet.Range("A1"))
        .TextFileParseType = xlDelimited
        .TextFileCommaDelimiter = True
        .Refresh
    End With

Categorized in:

VBA Excel,

Last Update: November 8, 2024