Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Name a New Workbook
In a macro, I have a main workbook open where I run the Macro.
What I want the macro to do is adding a few new workbooks (around 10 new workbooks), and then name them according to a list of names (F2:F11) in the main workbook. Is there any way to guide me to this? Thank you. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Name a New Workbook
Hi Yuanhang,
In a standard module, try: '============ Option Explicit Public Sub Tester001() Dim WB As Workbook Dim newWB As Workbook Dim SH As Worksheet Dim Rng As Range Dim rCell As Range Set WB = Workbooks("myBook.xls") '<<===== CHANGE Set SH = WB.Sheets("Sheet1") '<<===== CHANGE Set Rng = SH.Range("F2:F11") '<<===== CHANGE On Error GoTo XIT Application.ScreenUpdating = False For Each rCell In Rng.Cells Set newWB = Workbooks.Add With newWB .SaveAs Filename:=rCell.Value, _ FileFormat:=xlWorkbookNormal .Close SaveChanges:=False End With Next rCell XIT: Application.ScreenUpdating = True End Sub '<<============ --- Regards. Norman "Yuanhang" wrote in message ... In a macro, I have a main workbook open where I run the Macro. What I want the macro to do is adding a few new workbooks (around 10 new workbooks), and then name them according to a list of names (F2:F11) in the main workbook. Is there any way to guide me to this? Thank you. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Exceeding 65K of defined names within workbook causes workbook to go into repair mode when it is opened | Excel Programming | |||
loop through a column on a workbook copying data on each row to another workbook, then copy data back to the original workbook | Excel Programming | |||
Select sheet tabs in workbook & save to separate workbook files | Excel Worksheet Functions | |||
Running a macro to protect a workbook on a already protected workbook UNprotects the workbook ?? | Excel Programming | |||
What commands do you use to name a workbook, save a workbook,open a workbook | Excel Programming |