![]() |
How to add a worksheet automatically using macro in xls?
How can I create a macro wherein the actions include adding a new worksheet
and naming the worksheet based on a field in the worksheet? Ex: 1. Add a worksheet 2. Name the worksheet referencing a field already defined. 3. #1 and #2 is automatic ( ran thru macro) Please help. |
How to add a worksheet automatically using macro in xls?
Perhaps
Sub addasheet() Worksheets.Add ActiveSheet.Name = Worksheets("Sheet1").Range("A1").Value End Sub Mike "eva" wrote: How can I create a macro wherein the actions include adding a new worksheet and naming the worksheet based on a field in the worksheet? Ex: 1. Add a worksheet 2. Name the worksheet referencing a field already defined. 3. #1 and #2 is automatic ( ran thru macro) Please help. |
How to add a worksheet automatically using macro in xls?
eva
Sub Add_Sheets22() Dim rCell As Range For Each rCell In ActiveSheet.Range("A1") 'to add more than one sheet change range to ("A1:A10") or similar. With Worksheets.Add(After:=Worksheets(Worksheets.Count) ) .Name = rCell.Value End With Next rCell End Sub Gord Dibben MS Excel MVP On Mon, 3 Dec 2007 23:56:02 -0800, eva wrote: How can I create a macro wherein the actions include adding a new worksheet and naming the worksheet based on a field in the worksheet? Ex: 1. Add a worksheet 2. Name the worksheet referencing a field already defined. 3. #1 and #2 is automatic ( ran thru macro) Please help. |
All times are GMT +1. The time now is 02:55 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com