Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default A simple problem...

Hi,

just trying to add a worksheet behind an existing one and
naming it.
trying this:

Sheets.Add Type:=Worksheet, count:=1, after:=Sheets
(Origsheet)

but I'd like to assign a name to it (in the same
statement...must be possible..!!)

Thks

Chris
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default A simple problem...

One way:

Worksheets.Add(After:=Sheets(Origsheet)).Name = "Fred"

Where OrigSheet contains either an index number or a sheetname as a
string.

In article ,
"Chris Gorham" wrote:

Hi,

just trying to add a worksheet behind an existing one and
naming it.
trying this:

Sheets.Add Type:=Worksheet, count:=1, after:=Sheets
(Origsheet)

but I'd like to assign a name to it (in the same
statement...must be possible..!!)

Thks

Chris

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default A simple problem...

Try:

Private Sub CommandButton1_Click()
Dim shtNew As Worksheet
Set shtNew = ActiveWorkbook.Worksheets.Add
(After:=Worksheets(Worksheets.Count))
shtNew.Name = "New Sheet"
End Sub

HTH.

-Brad

-----Original Message-----
Hi,

just trying to add a worksheet behind an existing one and
naming it.
trying this:

Sheets.Add Type:=Worksheet, count:=1, after:=Sheets
(Origsheet)

but I'd like to assign a name to it (in the same
statement...must be possible..!!)

Thks

Chris
.

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
Simple problem, simple formula, no FUNCTION ! Ron@Buy Excel Worksheet Functions 6 September 28th 07 04:51 PM
Simple problem excelnovice1 New Users to Excel 3 June 29th 06 11:19 AM
Simple problem? Foobi Excel Worksheet Functions 3 February 10th 06 10:24 PM
Simple problem inquirer Excel Discussion (Misc queries) 4 April 16th 05 12:37 PM
Another simple little problem Jerry[_14_] Excel Programming 1 November 3rd 03 03:00 AM


All times are GMT +1. The time now is 12:40 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"