![]() |
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 |
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 |
All times are GMT +1. The time now is 02:07 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com