ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   automate creation of sheets in excel (https://www.excelbanter.com/excel-worksheet-functions/32187-automate-creation-sheets-excel.html)

Daniel

automate creation of sheets in excel
 
automate creation of sheets in excel

is there anyway to automate creation of sheets in excel? I would like to
have one sheet that has a master list of all items. then a have sheets which
are automaticaly generated, 1 sheet for every 30 items on the master sheet.
can this be done? is there some vba built into excell that i could use to do
this?



JE McGimpsey

One way:

This will add one sheet for every 30 items in your master list.

Assume you master list starts in A2 and extends down without blanks
intervening.

Public Sub AddSheetForEach30()
Dim nNumSheets As Long
Dim nLastRow As Long
Dim i As Long

nLastRow = Range("A" & Rows.Count).End(xlUp).Row - 1
nNumSheets = Application.Ceiling(nLastRow / 30, 1)
Do While nNumSheets 0
Worksheets.Add Count:=Application.Min(nNumSheets, 256)
nNumSheets = nNumSheets - 256
Loop
End Sub

In article ,
"Daniel" wrote:

automate creation of sheets in excel

is there anyway to automate creation of sheets in excel? I would like to
have one sheet that has a master list of all items. then a have sheets which
are automaticaly generated, 1 sheet for every 30 items on the master sheet.
can this be done? is there some vba built into excell that i could use to do
this?



All times are GMT +1. The time now is 01:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com