Worksheet Position

  • Thread starter Thread starter Todd Huttenstine
  • Start date Start date
T

Todd Huttenstine

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
 
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
 
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




--

Dave Peterson
(e-mail address removed)
.
 
Back
Top