Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 421
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Exceeding 65K of defined names within workbook causes workbook to go into repair mode when it is opened Ronald Dodge[_2_] Excel Programming 13 May 18th 07 02:24 PM
loop through a column on a workbook copying data on each row to another workbook, then copy data back to the original workbook burl_rfc Excel Programming 1 April 1st 06 08:48 PM
Select sheet tabs in workbook & save to separate workbook files stratocaster Excel Worksheet Functions 2 March 1st 06 03:35 PM
Running a macro to protect a workbook on a already protected workbook UNprotects the workbook ?? WimR Excel Programming 9 July 25th 05 12:44 PM
What commands do you use to name a workbook, save a workbook,open a workbook Steven R. Berke Excel Programming 1 July 24th 03 11:37 PM


All times are GMT +1. The time now is 06:19 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"