Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Add a New Worksheet

How do I add a new worksheet and give it a name by using
code, the name will be entered in cell A1 of sheet 1.

I want a button that I can click that will automatically
create the Worksheet at the end of the book with the name
in cell A1

THanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Add a New Worksheet

worksheets.Add(After:=Worksheets(worksheets.count) ).Name = _
Worksheets("sheet1").Range("A1")

--
Regards,
Tom Ogilvy


"Jaina Williams" wrote in message
...
How do I add a new worksheet and give it a name by using
code, the name will be entered in cell A1 of sheet 1.

I want a button that I can click that will automatically
create the Worksheet at the end of the book with the name
in cell A1

THanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Add a New Worksheet

THat worked so I tried some modifications to test
something,

this is what I did

Sheets("sheet2").Copy(After:=Worksheets_
(Worksheets.Count)).Name = Worksheets("sheet1").Range("A1")

It tells me Object is required
-----Original Message-----
worksheets.Add(After:=Worksheets(worksheets.count )).Name

= _
Worksheets("sheet1").Range("A1")

--
Regards,
Tom Ogilvy


"Jaina Williams"

wrote in message
...
How do I add a new worksheet and give it a name by using
code, the name will be entered in cell A1 of sheet 1.

I want a button that I can click that will automatically
create the Worksheet at the end of the book with the

name
in cell A1

THanks



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Add a New Worksheet

Adding a worksheet returns a reference to that sheet. Copying a worksheet
does not. Thus your problem. Use this:

Sheets("sheet2").Copy After:=Worksheets _
(Worksheets.Count)
ActiveSheet.Name = Worksheets("sheet1").Range("A1")

--
Regards,
Tom Ogilvy

"Jaina Williams" wrote in message
...
THat worked so I tried some modifications to test
something,

this is what I did

Sheets("sheet2").Copy(After:=Worksheets_
(Worksheets.Count)).Name = Worksheets("sheet1").Range("A1")

It tells me Object is required
-----Original Message-----
worksheets.Add(After:=Worksheets(worksheets.count )).Name

= _
Worksheets("sheet1").Range("A1")

--
Regards,
Tom Ogilvy


"Jaina Williams"

wrote in message
...
How do I add a new worksheet and give it a name by using
code, the name will be entered in cell A1 of sheet 1.

I want a button that I can click that will automatically
create the Worksheet at the end of the book with the

name
in cell A1

THanks



.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 32
Default Add a New Worksheet

Hi

the code for the button

Sheets.Add(, Sheets(Sheets.Count)).Name = "nameyouwant"
sheets(1).range("A1")="nameyouwant"

regards

Jaina Williams a écrit :

How do I add a new worksheet and give it a name by using
code, the name will be entered in cell A1 of sheet 1.

I want a button that I can click that will automatically
create the Worksheet at the end of the book with the name
in cell A1

THanks



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
automatically appending newly added data on worksheet to a master list worksheet tabylee via OfficeKB.com Links and Linking in Excel 0 December 17th 09 04:24 PM
plot graph from multiple worksheet as embedded chart object on every worksheet [email protected] Charts and Charting in Excel 3 August 24th 06 07:26 PM
plot graph from multiple worksheet as embedded chart object on every worksheet jeftiong New Users to Excel 0 August 23rd 06 01:50 PM
Upload multiple text files into 1 excel worksheet + put the filename as the first column in the worksheet Aster Excel Worksheet Functions 3 March 12th 06 09:58 AM
Attaching a JET database to an Excel Worksheet OR storing large binary data in a worksheet Ant Waters Excel Programming 1 September 3rd 03 11:34 AM


All times are GMT +1. The time now is 05:51 AM.

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"