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

Where do I add this in the code to make it work?
-----Original Message-----
There's a parm you can add to the worksheets.add. (Look

at VBA's help for more
info)

but this is one way:

With ActiveWorkbook.Worksheets
Set shar = .Add(after:=.Item(.Count))
End With


Todd Huttenstine wrote:

The below code creates a new sheet, however when the new
sheet is created, it is placed in the first sheet
position. I would like the newly created sheet to be
placed at the end of all the other sheets. How do I do
this?

Thanx

Private Sub CommandButton1_Click()
Dim sha As Worksheet
Dim shar As Worksheet

Set sha = Worksheets(1)
Set shar = ActiveWorkbook.Worksheets.Add

sha.Cells.Copy

shar.Cells.PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, _
SkipBlanks:=False, _
Transpose:=False

shar.Cells.PasteSpecial Paste:=xlPasteFormats, _
Operation:=xlNone, _
SkipBlanks:=False, _
Transpose:=False

shar.Name = sha.Range("E2").Value

ActiveWindow.DisplayZeros = False
Worksheets(2).Select
End Sub


--

Dave Peterson

.

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
Add worksheet at end or last position Brent E Excel Discussion (Misc queries) 4 August 18th 08 10:38 PM
Worksheet Tas position fgwiii[_2_] Excel Discussion (Misc queries) 2 April 2nd 08 09:39 PM
how do I fix the position of a worksheet in excel? MartyMac Excel Worksheet Functions 1 December 15th 06 06:07 PM
Set position into a worksheet using vba Ricardo Mercader Charts and Charting in Excel 2 October 22nd 05 07:09 PM
How do you identify if a worksheet is in the last position in a Macro? Natasha[_2_] Excel Programming 2 August 8th 03 03:32 AM


All times are GMT +1. The time now is 05:59 PM.

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

About Us

"It's about Microsoft Excel"