PC Review


Reply
Thread Tools Rate Thread

Re: Help with VBA Macro needed

 
 
Auric__
Guest
Posts: n/a
 
      6th Apr 2012
"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.
 
Reply With Quote
 
 
 
 
Auric__
Guest
Posts: n/a
 
      6th Apr 2012
I wrote:

> nextFile = Dir$("C:\users\Erik\Desktop\*.csv")


Whoops... that should be:

nextFile = Dir$("C:\Documents and Settings\my.computer\Desktop\*.csv")

Forgot to change it from my "test" settings.

--
As he walked into the blinding golden light he turned, and looked
back over his shoulder. He smiled at me... I never saw him again.
 
Reply With Quote
 
 
 
 
rumkus@hotmail.com
Guest
Posts: n/a
 
      6th Apr 2012
> As he walked into the blinding golden light he turned, and looked
> back over his shoulder. He smiled at me... I never saw him again.


Keep stalking Auric.
I am sure you will see them again in the police station
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HELP NEEDED FAST!!! HELP HELP HELP HELP HELP HELP FAST HELP NEEDED Jonathan Windows XP General 10 13th Jan 2005 03:22 AM
Re: Macro in VBA: Setting a variable print range HELP NEEDED!! Ron de Bruin Microsoft Excel Programming 1 21st Jul 2004 05:45 PM
Re: VBA/Macro Help Needed Earl Kiosterud Microsoft Excel Discussion 2 29th Dec 2003 09:20 PM
Re: VBA/Macro Help Needed Earl Kiosterud Microsoft Excel Programming 1 29th Dec 2003 06:03 AM
Help! Help! Help! Help! Help! Help! Help! Help! Help! Help! Help! Help! Help! -$- Windows XP Internet Explorer 2 21st Dec 2003 11:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:59 PM.