Moving files




Every month i get a output from our system of about 3000 excel files into a
folder say c:\output\ the files are number numberically 1.xls 2.xls 3.xls
But out of these files i only need about 30, i have a list of these files,
and i need to copy them from their current destination to c:\users\bg56\
Is is possible to create a macro, where is i can populate a column say
A1:A50 with the file numbers i need 1 2 50 75 55 and have the macro move
those files ?

I know basic vba but not how to move files, so all help is greatly


Don Guillett

You will be surprised to see that it's easier than you would think. All you
do is rename. Here is the basic idea. Modify to suit your files.

Sub movefile()
OldName = "C:\personal\1065.xls"
newname = "C:\a\1065.xls"
On Error GoTo killit
Name OldName As newname
ans = InputBox("do you", vbOKCancel)
If ans = Cancel Then Exit Sub
If ans = OK Then
MsgBox newname
'Kill newname
End If
End Sub

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question