View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
inungh inungh is offline
external usenet poster
 
Posts: 33
Default Insert multi spreadsheet

On Apr 1, 11:52*am, john wrote:
something like following may do what you want:

Sub AddSheets()
* * Dim sheetname As Range
* * Dim NewWs As Worksheet

* * With ThisWorkbook

* * * * For na = 1 To 20

* * * * * * 'the worksheet & range where list of names are stored
* * * * * * 'change as required
* * * * * * Set sheetname = .Worksheets("Sheet1").Range("A" & na)

* * * * * * If Not IsEmpty(sheetname.Value) Then

* * * * * * * * Set NewWs = .Worksheets.Add

* * * * * * * * NewWs.Move After:=.Worksheets(.Worksheets.Count)

* * * * * * * * NewWs.Name = sheetname.Value

* * * * * * End If

* * * * * * Next

* * * * End With

* * End Sub

I have assumed your sheet names are in Col A of worksheet named Sheet1.
Change as required.
--
jb



"inungh" wrote:
On Apr 1, 8:59 am, wrote:
On Apr 1, 8:48 am, inungh wrote: I need insert about 20 spreadsheet for my report every day.
I just wanted to know is it possible to insert all 20 pages in one
shot?


Your information is great appreciated,


Inungh,


Use the count argument of the Add method for worksheets, e.g.
Worksheets.Add Count:=20.


Best,


Matt Herbert


Thanks again,
I would like to rename all the spreadsheet from a list of cells.
Can you please show me how to rename the spreadsheet?


Thanks again,- Hide quoted text -


- Show quoted text -


Thanks millions,