Help with VBA Macro needed
"Me" wrote:
I created this Macro, but want to make a change but dont know how..
Hopefully someone can offer assitance.
Question1.
Instead of it looking for the file 1.csv, I want to look for all .CSV
files on my desktop, and allow me to choose the one to import
Try this:
Sub allCSVsOnDesktop()
nextFile = Dir$("C:\users\Erik\Desktop\*.csv")
While Len(nextFile)
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;C:\Documents and Settings\my.computer\Desktop\" & nextFile, _
Destination:=Range("A1"))
'everything you want to do with the table goes here
End With
nextFile = Dir$
Wend
End Sub
--
I'll see you tomorrow for our usual drink and argument.
|