I want to Insert Data from a column (B2:B45) from csv file,directly via Dialog box (( to choose csv file )) , which opening from the standard excel file ( xlsm )
the CSV file called : StudentClass.CSV
I've tried this :
Private Sub importv_Click()
Dim fd As Office.FileDialog
Set fd = Application.FileDialog(msoFileDialogFilePicker)
With fd
.Filters.Clear
.Title = "Select a CVS File"
.Filters.Add "CSV", "*.csv", 1
.AllowMultiSelect = False
Dim fileName As String
If .Show = True Then
fileName = .SelectedItems(1)
End If
End With
' import
If fileName <> "" Then
Range("B2:B45").Select
Selection.ClearContents
Range("B2").Select
----------------------------------------
Now, I don't know How can I get data from column (B2:B45) from ( StudentClass.csv ) and insert it just i press OK from dialog box..
Any one can help me ?
the CSV file called : StudentClass.CSV
I've tried this :
Private Sub importv_Click()
Dim fd As Office.FileDialog
Set fd = Application.FileDialog(msoFileDialogFilePicker)
With fd
.Filters.Clear
.Title = "Select a CVS File"
.Filters.Add "CSV", "*.csv", 1
.AllowMultiSelect = False
Dim fileName As String
If .Show = True Then
fileName = .SelectedItems(1)
End If
End With
' import
If fileName <> "" Then
Range("B2:B45").Select
Selection.ClearContents
Range("B2").Select
----------------------------------------
Now, I don't know How can I get data from column (B2:B45) from ( StudentClass.csv ) and insert it just i press OK from dialog box..
Any one can help me ?