ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Moving files (https://www.excelbanter.com/excel-programming/418064-moving-files.html)

Naz

Moving files
 
Hello

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
appreciated.


Thanks
--

_______________________
Naz,
London

Thomas [PBD]

Moving files
 
Naz,

Ron DeBruin has a great VBA tutorial on this:
http://www.rondebruin.nl/folder.htm#Copy

--
--Thomas [PBD]
Working hard to make working easy.
Answered your question? Click ''Yes'' below.


"Naz" wrote:

Hello

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
appreciated.


Thanks
--

_______________________
Naz,
London


Don Guillett

Moving files
 
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()
startit:
OldName = "C:\personal\1065.xls"
newname = "C:\a\1065.xls"
On Error GoTo killit
Name OldName As newname
killit:
ans = InputBox("do you", vbOKCancel)
If ans = Cancel Then Exit Sub
If ans = OK Then
MsgBox newname
'Kill newname
End If
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Naz" wrote in message
...
Hello

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
appreciated.


Thanks
--

_______________________
Naz,
London




All times are GMT +1. The time now is 12:47 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com