View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Extracting/copying files from a folder using VBA

assume the list of 200 is in column A of the activesheet and the file names
are like a.csv or aaa.csv rather than c:\current\aaa.csv

Sub copysomefiles()
Dim cell as Range
for each cell in Range("A1:A200")
filecopy "c:\current\" & cell.name, "c:\new\ & cell.name"
Next
end Sub

--
Regards,
Tom Ogilvy


"Bhupinder Rayat" wrote in
message ...
Hi all,

I have a folder (i.e. c:\current) that contains around 5000 csv files, and

I
have a list of around 200 off these files that I need to copy and paste to

a
new folder i.e. (c:\new).

Rather than find each file manually or use the search function, is there a
way i can tell vba to search through c:\current for the filenames that I
specify and then copy and paste them to c:\new?

Any help would be much appreciated.

Kind Regards,

Bhupinder.