ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   creating sheets with names from cells (https://www.excelbanter.com/excel-programming/333282-creating-sheets-names-cells.html)

masseysmate

creating sheets with names from cells
 
I have seen and used code from this list that creates a worksheet with a name
from a specific cell.

What i'm now looking for is a way to create a variable number of sheets to
match the input from users, e.g. one week there will be a list in column A
of 3 items (perhaps 517,518,519) the next week a list of 4 items (possibly
517,519,612,613) and i want a sheet created and named for each of these.

could anyone point me in the right direction?

tia

Roman[_4_]

creating sheets with names from cells
 
Hi Tia,
just select cells with names of new sheets and run this:

Sub newsheets()
on error resume next
Dim ns As Worksheet
For Each ncell In Selection
Set ns = Worksheets.Add(after:=Worksheets(Worksheets.Count) )
ns.Name = ncell.Value
Next ncell
End Sub



All times are GMT +1. The time now is 12:31 AM.

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