Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Add worksheet at end or last position | Excel Discussion (Misc queries) | |||
Worksheet Tas position | Excel Discussion (Misc queries) | |||
how do I fix the position of a worksheet in excel? | Excel Worksheet Functions | |||
Set position into a worksheet using vba | Charts and Charting in Excel | |||
How do you identify if a worksheet is in the last position in a Macro? | Excel Programming |