worksheet appearance

  • Thread starter Thread starter tinybears
  • Start date Start date
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?
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top