I don't think you can change the code name off a sheet with vba??
The help say <You cannot programmatically change this property at run time.
Try this with the names in row 1 off Sheet1
It will ad a sheet template named c:\Sheet.xlt
Sub test()
Dim cell As Range
Dim sh As Worksheet
For Each cell In Sheets("Sheet1").Rows(1).Cells.SpecialCells(xlCell TypeConstants)
Set sh = Sheets.Add(Type:="c:\Sheet.xlt")
On Error Resume Next
sh.Name = cell.Value
On Error GoTo 0
Next
End Sub
--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2002 SP-2)
www.rondebruin.nl
"Scott Lyon" <scott.lyonNOSPAM_at__NOSPAMrapistan.comNOSPAM wrote in message ...
I'm not sure if I can do this, as I tried doing the "record a macro" trick,
and then trying it manually, and checking what recorded in the macro... Only
to find that the macro was pretty much empty.
In a nutshell, what I've got is an Excel spreadsheet that has a bunch of
worksheets already. I want to write a macro/subroutine/function that I can
call, that will check one of the current worksheets, and for each cell (with
data) on a given line, will add a worksheet (copied from a "template"
worksheet), setting the worksheet name (both the tab and in the properties)
to the name of the selected cell.
Ideally, I'd like to have it also do a "search & replace" on the VBA code in
the new worksheet (based on the template), to adjust things to match the
file. But I can do that by hand if necessary.
Is any of this going to be possible to automate? Or am I stuck with tons of
clicking?
(Basically, I need to add a few hundred worksheets in this fashion - now you
know why I'd rather automate the process)
Thanks!
-Scott