Dim ws As Worksheet, sPath As String
Dim DialogBox As FileDialog
Set DialogBox = Application.FileDialog(msoFileDialogFilePicker)
With DialogBox
.Title = "Select file to import CSV"
.Filters.Add "Comma Separated Files", "*.csv", 1
.Show
End With
If DialogBox.SelectedItems.Count = 1 Then
sPath = DialogBox.SelectedItems(1)
Set ws = ActiveWorkbook.Sheets("Test") 'Name of the sheet where you want to import the CSV file, change this to your case
With ws.QueryTables.Add(Connection:="TEXT;" & sPath, Destination:=ws.Range("b1")) ' first row in column B
.TextFileParseType = xlDelimited
.TextFileCommaDelimiter = True
.Refresh
End With
Else
MsgBox "No files selected !"
End If