Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Sub to copy n rename book according to list

Hi, seeking help for a sub to do this
In D:\Max, I've got 2 "template" books prepared
DBrT.xls
PBrT.xls

In Sheet1, I've got the List of D Branch names in col A, List of P Branch
names in col B, eg:
In A1 down
Dxx1
Dxx2
Dxx3
....
In B1 down
Pzz1
Pzz2
Pzz3
....

I would like to run a sub from Sheet1 which will create a folder (ie
D:\Max\DBrT) & then copy/rename DBrT.xls according to the list of D Branch
names in col A into this folder. And to do likewise for the P Branch names
(copy/rename PBrT.xls into D:\Max\PBrT), so that I'd end up with this:

In D:\Max\DBrT
Dxx1.xls
Dxx2.xls
Dxx3.xls
....

In D:\Max\PBrT
Pzz1.xls
Pzz2.xls
Pzz3.xls
....

Thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Sub to copy n rename book according to list

Found some code from Ron's page:
http://www.rondebruin.nl/folder.htm

Tinkered with Ron's: Sub Copy_One_File() like below
(I had to pre-create the dest. folder: D:\Max\DBrT, but this is not a
problem)

Sub Copy_One_File()
FileCopy "D:\Max\DBrT.xls", "D:\Max\DBrT\Dxx1.xls"
FileCopy "D:\Max\DBrT.xls", "D:\Max\DBrT\Dxx2.xls"
FileCopy "D:\Max\DBrT.xls", "D:\Max\DBrT\Dxx3.xls"
End Sub

The above works ok in my tests, but I don't know
how to get it to loop through & read/use all the destination names, ie:
Dxx1
Dxx2
Dxx3
etc
from the list of 100+ branch names that's placed in col A in the active
sheet?
Thanks for insights / any alternatives


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
copy worksheets to new book without linking to original book Lori Excel Discussion (Misc queries) 2 March 4th 09 04:46 PM
excel list of names, addresses and email to address book/contact list??? anna Excel Discussion (Misc queries) 0 October 24th 08 05:49 PM
How can I copy sheet, fill in cell from list and rename worksheet? [email protected] Excel Programming 4 July 31st 06 07:44 AM
Change/Rename List Django Excel Discussion (Misc queries) 0 June 27th 06 07:33 PM
Rename File from list Cesar Zapata[_2_] Excel Programming 1 April 14th 04 06:52 PM


All times are GMT +1. The time now is 07:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"