Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 573
Default duplicate spreadsheets with different names

davegb Mar 9, 12:19 pm show options

Newsgroups: microsoft.public.excel
From: "davegb" - Find messages by this author
Date: 9 Mar 2005 12:19:22 -0800
Local: Wed, Mar 9 2005 12:19 pm
Subject: duplicate spreadsheets with different names
Reply | Reply to Author | Forward | Print | Individual Message | Show
original | Remove | Report Abuse

I'm creating spreadsheets for each county in the state (64). I've
created a master spreadsheet, with macros and buttons to make things
easier for state employees. Now, I need to make 63 copies of this
spreadsheet, one for each county, with the county name in a merged cell

in the upper left corner (where A1 would be) of each worksheet,
following other descriptive text. Each spreadsheet will be named by
county and put in a county folder.


To clarify, I need a macro to create 64 folders, one for each county (I

already know how to do that), then take a standard workbook, or
template, give it the county name along with other descriptive text,
put the county name in following other text in the first cell in each
sheet in the workbook, and place it in the appropriate county folder.


Of course, I'm going to set up and test this on my local hard drive
with about 5 "counties", and after it works there, change the path for
the folders and spreadsheets to go to, the server, and do the actual
creation of the user files there.


Can anyone help me with this? Thanks in advance!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 252
Default duplicate spreadsheets with different names

I would start with a Named Range, (Counties) in your Master.xls

Then

Dim oCell as Range
For each oCell in Range("Counties")
ThisWorkbook.SaveAs (FileName:=oCell.Value)
Activeworkbook.Range("A1")=oCell.Value
''' More Code
Activeworkbook.Close True
Next oCell

Hope this helps get you started

"davegb" wrote:

davegb Mar 9, 12:19 pm show options

Newsgroups: microsoft.public.excel
From: "davegb" - Find messages by this author
Date: 9 Mar 2005 12:19:22 -0800
Local: Wed, Mar 9 2005 12:19 pm
Subject: duplicate spreadsheets with different names
Reply | Reply to Author | Forward | Print | Individual Message | Show
original | Remove | Report Abuse

I'm creating spreadsheets for each county in the state (64). I've
created a master spreadsheet, with macros and buttons to make things
easier for state employees. Now, I need to make 63 copies of this
spreadsheet, one for each county, with the county name in a merged cell

in the upper left corner (where A1 would be) of each worksheet,
following other descriptive text. Each spreadsheet will be named by
county and put in a county folder.


To clarify, I need a macro to create 64 folders, one for each county (I

already know how to do that), then take a standard workbook, or
template, give it the county name along with other descriptive text,
put the county name in following other text in the first cell in each
sheet in the workbook, and place it in the appropriate county folder.


Of course, I'm going to set up and test this on my local hard drive
with about 5 "counties", and after it works there, change the path for
the folders and spreadsheets to go to, the server, and do the actual
creation of the user files there.


Can anyone help me with this? Thanks in advance!


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default duplicate spreadsheets with different names

Might be faster to save it only once and probably should stick with
activeworkbook

Dim oCell as Range
Dim sPath as String
sPath = "M:\MyFolder\"
For each oCell in Range("Counties")
workbooks.Open("C:\MyFolder\MyTemplate.xls")
for each sh in ActiveWorkbook
sh.Range("A1")=oCell.Value
Next
''' More Code
ActiveWorkbook.SaveAs (FileName:=sPath & oCell.Value & "\" & oCell.Value)
' workbook is saved, so just close it
Activeworkbook.Close Savechanges:=False
Next oCell



"gocush" /delete wrote in message
...
I would start with a Named Range, (Counties) in your Master.xls

Then

Dim oCell as Range
For each oCell in Range("Counties")
ThisWorkbook.SaveAs (FileName:=oCell.Value)
Activeworkbook.Range("A1")=oCell.Value
''' More Code
Activeworkbook.Close True
Next oCell

Hope this helps get you started

"davegb" wrote:

davegb Mar 9, 12:19 pm show options

Newsgroups: microsoft.public.excel
From: "davegb" - Find messages by this author
Date: 9 Mar 2005 12:19:22 -0800
Local: Wed, Mar 9 2005 12:19 pm
Subject: duplicate spreadsheets with different names
Reply | Reply to Author | Forward | Print | Individual Message | Show
original | Remove | Report Abuse

I'm creating spreadsheets for each county in the state (64). I've
created a master spreadsheet, with macros and buttons to make things
easier for state employees. Now, I need to make 63 copies of this
spreadsheet, one for each county, with the county name in a merged cell

in the upper left corner (where A1 would be) of each worksheet,
following other descriptive text. Each spreadsheet will be named by
county and put in a county folder.


To clarify, I need a macro to create 64 folders, one for each county (I

already know how to do that), then take a standard workbook, or
template, give it the county name along with other descriptive text,
put the county name in following other text in the first cell in each
sheet in the workbook, and place it in the appropriate county folder.


Of course, I'm going to set up and test this on my local hard drive
with about 5 "counties", and after it works there, change the path for
the folders and spreadsheets to go to, the server, and do the actual
creation of the user files there.


Can anyone help me with this? Thanks in advance!




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
Duplicate data in multiple spreadsheets L Excel Worksheet Functions 5 June 27th 08 12:01 PM
How do I get rid of duplicate spreadsheets? louise Excel Discussion (Misc queries) 9 May 15th 08 01:00 AM
Comparing 2 spreadsheets to remove duplicate names Marc Hamel Excel Discussion (Misc queries) 2 December 6th 07 03:21 PM
How do you delete duplicate addresses, but keep duplicate names? Shelly Excel Discussion (Misc queries) 1 August 28th 06 10:36 PM
finding duplicate data in multiple spreadsheets Robert Poole Excel Programming 1 September 9th 03 02:32 PM


All times are GMT +1. The time now is 05:41 AM.

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

About Us

"It's about Microsoft Excel"