Thread: Hiding sheets
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Fabricio Fabricio is offline
external usenet poster
 
Posts: 9
Default Hiding sheets

Hey, I think I can help with this!

Open up VB (from Excel) by clicking Alt+F11. You should see a list of your
worksheets on the Project Explorer pane. It's usually named "Project -
VBAProject" and resides on the upper left corner. If you don't see the
Project Explorer go to View--Project Explorer. After the worksheets you
should see a workbook by the name of "ThisWorkbook". Double-click this guy
and paste your code in this window (wrapped around the following code):

Private Sub Workbook_SheetCalculate(ByVal Sh As Object)
<Your (or MVPs) code here
End Sub

Hope this helps,
-Fabricio


"Natalie" wrote:

Hello All,

I have numerous sheets and I would like to show or hide
them based on the month. IE. If it is Jan hide all my
other sheets apart from the Jan sheet, this is to stop
people seeing the data.

I got the following code from an MVP from this site. But
I don't know what to do with it. I'm a beginner in Vb so
please bear with me!!

Dim MyMonth As Integer
MyMonth = Month(Now())

Select Case MyMonth

Case 1 'If month number is 1 (Jan)
Sheets("Feb").Visible = False
Sheets("Mar").Visible = False
Case 2 'If Month number is 2 (Feb)
Sheets("Jan").Visible = False
Sheets("March").Visible = False
Case 3 'If Month number is 3 (Mar)
Sheets("Jan").Visible = False
Sheets("Mar").Visible = True
Sheets("Feb").Visible = False
End Select
End Sub

The Expert suggested I put this in the Open workbook
event??? Where is that please?

Thank for reading

Natalie