Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Eva Eva is offline
external usenet poster
 
Posts: 197
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default 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.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default 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.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro that runs when worksheet is automatically updated Lambi000 Excel Worksheet Functions 2 November 14th 07 07:33 PM
Macro add worksheet to workbook automatically Davin Excel Discussion (Misc queries) 0 February 17th 06 05:36 PM
Run macro automatically on opening of worksheet bnkone Excel Worksheet Functions 1 February 13th 06 09:46 PM
Automatically pasting worksheet data to new worksheet with formulas COntactJason Excel Worksheet Functions 0 August 10th 05 08:22 PM
Macro to automatically run Pam C Excel Discussion (Misc queries) 1 May 5th 05 02:35 PM


All times are GMT +1. The time now is 11:31 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"