PC Review


Reply
Thread Tools Rate Thread

Copy a File 'n' Times, New Filenames are "File_n.xls"

 
 
zwestbrook
Guest
Posts: n/a
 
      18th Sep 2007
I have a "master" spreadsheet and a "template" spreadsheet. The master
has various things on it and will be used to aggregate data from
multiple workbooks. One sheet in the master has a list of departments
(say deptA, deptB, deptC...). I have a button on the sheet that I want
to use to generate a copy of the template for each dept in the list
(code below). All files reside in the same folder. I currently have
pieced together working code for various pieces of what I want but
cannot get it to work all together. I am very new at VBA. Your help is
much appreciated!!!

In the code "test.xls" is the template file.

-------
Option Explicit
Private Sub CommandButton1_Click()
Dim myCell As Range
Dim sourceFile, myName
sourceFile = "test.xls"


With Worksheets("Sheet1")
For Each myCell In .Range(("A1"), _
.Cells(.Rows.Count, 1).End(xlUp)).Cells

FileCopy sourceFile, myCell.Value & ".xls"

Next myCell
End With
End Sub

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Selecting "Save As" adds "Copy of" to file name- MS Excel 2007 ronhansen Microsoft Excel Misc 1 15th Nov 2009 09:33 PM
Copy Rows Multiple times "changing" values in one column EE Microsoft Excel Programming 4 12th Oct 2007 11:32 AM
eliminate "copy" of "saved as" document showing up in file list =?Utf-8?B?S2Fib29kbGU=?= Microsoft Word Document Management 2 14th Feb 2007 11:06 AM
Print Outlook Calendar without "Ending Times" - only "Start Times" =?Utf-8?B?SmltbXk=?= Microsoft Outlook Calendar 0 9th Feb 2006 05:58 PM
Simple Macro to copy each row in the database "X" times? (Excel 2002) AlanN Microsoft Excel Misc 2 6th Feb 2004 08:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:24 AM.