create a sheet but hiding it

  • Thread starter Thread starter Maileen
  • Start date Start date
M

Maileen

Hi,

When i open a form, my form check if a sheet call "admin" exists.
if not, it creates it.

Unfortunately, creating this sheet, show it to user's view...
1. i would like to create this missing sheet but hide its creation to
user's view. How can i do that ?

2. i would like to create this missing sheet but not on first position.
for example, i have already 1 existing sheet...and all sheets that i
create are inserted before the existing / focused sheet... can i setup
somewhere where i want to insert this new sheet ?

thanks a lot,
Maileen
 
Hi
1.
application.screenupdating=false
'create the sheet
application.screenupdating=true

2. Hi have a look at the VBA help for the 'After' part of the insert
sheet method
 
Sub CheckAdminPage()
Dim CurSheet As String, NS As Object
Dim AdminPage As String
On Error GoTo SkipAll


AdminPage = "AdminPage"


CurSheet = ActiveSheet.Name
Application.ScreenUpdating = False

For Each c In ThisWorkbook.Sheets
If c.Name = AdminPage Then Exit Sub
Next

Set NS = ThisWorkbook.Sheets.Add
NS.Activate

NS.Name = AdminPage
NS.Move after:=Sheets(ThisWorkbook.Sheets.Count)
NS.Visible = False
Sheets(CurSheet).Activate


SkipAll:
Application.ScreenUpdating = True

End Su
 

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