file and folder help. Please :)

  • Thread starter Thread starter Aliandro
  • Start date Start date
A

Aliandro

Hi I have a list of files in an excel sheet in the first column I would like
to know is there a way I can get excel to search for these files by giving
it a dirctory and then it would copy the files to a directory I set, so say
I have the following in an excel document
15632.dxf
55555.dxf
95854.dxf

now they are under directory X

and the directory I want them to be copier to is XX

is there a way to do this, I would appreciate any help


Thanks.
Ali
 
Aliandro,

Sub CopyFiles()
Range("A2").Select ' starting cell
Do While Selection <> ""
FileCopy "C:\x\" & Selection, "c:\xx\" & Selection
Selection.Offset(1, 0).Select ' move selection down
Loop
End Sub

Paste or type this stuff into a regular module. Don't leave out the
periods. We don't usually use Selection like this in macros, but it's good
for getting started.
 
Back
Top