ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Add sheets with name as in cells in a specific sheet (https://www.excelbanter.com/excel-programming/372272-add-sheets-name-cells-specific-sheet.html)

sverre

Add sheets with name as in cells in a specific sheet
 
Hi

I want to add sheets to the right and name them after cell value starting from
Cell A3 in sheet "sammanställning" and ending with creation of sheets when
value in cell Ax is empty.

Is this hard to do?
Sverre

Tom Ogilvy

Add sheets with name as in cells in a specific sheet
 
Sub Addsheets()
Dim rng as Range, cell as Range
with worksheets("sammanställning")
set rng = .Range("A3",.Range("A3").End(xldown))
End with

for each cell in rng
worksheets.Add After:=Worksheets(worksheets.count)
activesheet.name = cell.value
Next
end sub

This assumes there will aways be at least values in A3 and A4. Otherwise,
you will have to add code that handles just one or no values.

--
Regards,
Tom Ogilvy

"sverre" wrote:

Hi

I want to add sheets to the right and name them after cell value starting from
Cell A3 in sheet "sammanställning" and ending with creation of sheets when
value in cell Ax is empty.

Is this hard to do?
Sverre



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

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