Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
open save as from list
I have a spreadsheet with 150 names
I have a template I need to open the template and save as a name from the names spreadsheet this should leave me with 150 seperate files each with a name from the list I assume a macro is the best way to do this Thanxs in advance |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
open save as from list
The code below should work check the follwing
1) the GetOpenFileName I used XLT as the extension. Change as required 2) I didn't know if the Range of Filenames contained an extension. I added "xls" to the filenames. Remove if the names on your worksheet already contains an extension 3) Change the SaveFolder as required. 4) Change FileNameRange as required. Sub savefiles() SaveFolder = "c:\temp\" Set FileNameRange = Sheets("Sheet1").Range("A1:A20") filetoopen = Application _ .GetOpenFilename("Templet Files (*.xlt), *.xlt") If filetoopen = False Then MsgBox ("Cannot open Templet -= exiting sug") Exit Sub End If Set Templet = Workbooks.Open(Filename:=filetoopen) For Each FName In FileNameRange If FName < "" Then Set Templet = Workbooks.Open(Filename:=filetoopen) Templet.SaveAs Filename:=Folder & FName.Value & ".xls" Templet.Close End If Next FName End Sub "seans" wrote: I have a spreadsheet with 150 names I have a template I need to open the template and save as a name from the names spreadsheet this should leave me with 150 seperate files each with a name from the list I assume a macro is the best way to do this Thanxs in advance |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
whenever open or save it is very slow to open | Excel Discussion (Misc queries) | |||
excel macro to open Sharepoint list in excel and save in my folde | Excel Programming | |||
open (or save to) other workbooks | Excel Programming | |||
Open and Save XML | Excel Discussion (Misc queries) | |||
Cancel in Save As and Open | Excel Programming |