workbook open event

  • Thread starter Thread starter User
  • Start date Start date
U

User

dears,

I want the workbook when it is opened to activate a specific sheet and
hide the remaining sheets. please help me in this regard.

thanks,
naweed
 
Put the following code in the ThisWorkbook module:

Private Sub Workbook_Open()
Dim ws As Worksheet
For Each ws In Worksheets
If ws.name <> "xxx" then ws.Visible = xlSheetHidden
Next
End Sub
_________________________________________________________________________
 
Try this

Private Sub Workbook_Open()
Sheet1.Activate
Sheet2.Visible = xlSheetHidden
Sheet3.Visible = xlSheetHidden
End Sub
 
Try:-

Private Sub Workbook_Open()
For i = 1 To ActiveWorkbook.Worksheets.Count
Worksheets(i).Select
If Worksheets(i).Name <> "Sheet1" Then ' Change to be the one you want active
Worksheets(i).Visible = False
End If
Next i
End Sub


Mike
 
No need to select any of the worksheets.
_________________________________________________________________________
 

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