Hi,
I am trying to create a macro which reads in the selected .csv file into a worksheet called CRData. When I run the macro which is attached to a worksheet, I would like the data to be added to the CRData worksheet. I have only written the code below and am stuck right now. Any advice would be appreciated.
-Eileen
I am trying to create a macro which reads in the selected .csv file into a worksheet called CRData. When I run the macro which is attached to a worksheet, I would like the data to be added to the CRData worksheet. I have only written the code below and am stuck right now. Any advice would be appreciated.
Code:
' get name of the .csv file from the user
Dim lstrFileName As String
lstrFileName = Application.GetOpenFilename(FileFilter:="All Files(*.*), *.*", Title:="MyTitle:::: Select the File to Load")
' not sure if I should use Query tables
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;" & lstrFileName & "", _
Destination:=Range("AD5"))
Worksheets("CRData").Cells.Clear
-Eileen