worksheet appearance

T

tinybears

Hey,

I create worksheets in VBA, then delete them again and create them
again.
One worksheet always stays in my workbook, but when I create such a new
worksheet with add it appears the first in line. I want it to appear it
after the worksheet stat is always visible.

How can I solve this?
 
J

JE McGimpsey

From XL/VBA Help:
Add Method (Worksheets Collection)

Creates a new worksheet. The new worksheet becomes the active sheet. Returns
a Worksheet object.
Syntax
expression.Add(Before, After, Count, Type)
expression Required. An expression that returns a Worksheets object.
Before Optional Variant. An object that specifies the sheet before which
the new sheet is added.
After Optional Variant. An object that specifies the sheet after which the
new sheet is added.

So

Worksheets.Add After:=Worksheets(1)

Alternatively, this always adds the sheet at the right-side of the
worksheet stack:

With Worksheets
.Add After:=.Count
End With
 
Top