Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default Indicating worksheets are hidden

Hi everyone
I have a one or two workbooks that have hidden sheets.
Can anyone help with a macro to indicate via a msgbox
that the workbook just opened contains hidden sheets.?
Is it possible to list the hidden sheet (Tab) names in
the msgbox.?

I tried to modify code I found on this site, which
informed the user, the sheet tab they had just click on
contained hidden rows

My code so far does not work, the msgbox shows up whether
sheets are hidden or not.

Private Sub Workbook_Open()
'
On Error GoTo EndMacro:
If Me.ActiveWorkbook.Worksheets.Count < _
Me.ActiveWorkbook.Worksheets
(xlHidden).ActiveWorkbook.Worksheets.Count Then
MsgBox "This Workbook has Hidden Worksheets."
End If
EndMacro:
'
End Sub

TIA

Regards Bob C

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Indicating worksheets are hidden

Try this

For Each sh In ThisWorkbook.Sheets
If sh.Visible = True Then hidcount = hidcount + 1
Next
AllSheets = ThisWorkbook.Sheets.Count
MsgBox "There are " & AllSheets & " sheets but " & hidcount & " are hidden"


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Robert Christie" wrote in message ...
Hi everyone
I have a one or two workbooks that have hidden sheets.
Can anyone help with a macro to indicate via a msgbox
that the workbook just opened contains hidden sheets.?
Is it possible to list the hidden sheet (Tab) names in
the msgbox.?

I tried to modify code I found on this site, which
informed the user, the sheet tab they had just click on
contained hidden rows

My code so far does not work, the msgbox shows up whether
sheets are hidden or not.

Private Sub Workbook_Open()
'
On Error GoTo EndMacro:
If Me.ActiveWorkbook.Worksheets.Count < _
Me.ActiveWorkbook.Worksheets
(xlHidden).ActiveWorkbook.Worksheets.Count Then
MsgBox "This Workbook has Hidden Worksheets."
End If
EndMacro:
'
End Sub

TIA

Regards Bob C



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default Indicating worksheets are hidden

Hi Ron

Had to re-word the MsgBox " are hidden to " visible"
As test of code on total 3 sheets with 2 hidden = 1 is
indicating open sheets.

Thankyou

Bob C.

-----Original Message-----
Try this

For Each sh In ThisWorkbook.Sheets
If sh.Visible = True Then hidcount = hidcount + 1
Next
AllSheets = ThisWorkbook.Sheets.Count
MsgBox "There are " & AllSheets & " sheets but " &

hidcount & " are hidden"


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Robert Christie"

wrote in message news:14a4901c3f929$18390030
...
Hi everyone
I have a one or two workbooks that have hidden sheets.
Can anyone help with a macro to indicate via a msgbox
that the workbook just opened contains hidden sheets.?
Is it possible to list the hidden sheet (Tab) names in
the msgbox.?

I tried to modify code I found on this site, which
informed the user, the sheet tab they had just click on
contained hidden rows

My code so far does not work, the msgbox shows up

whether
sheets are hidden or not.

Private Sub Workbook_Open()
'
On Error GoTo EndMacro:
If Me.ActiveWorkbook.Worksheets.Count < _
Me.ActiveWorkbook.Worksheets
(xlHidden).ActiveWorkbook.Worksheets.Count Then
MsgBox "This Workbook has Hidden Worksheets."
End If
EndMacro:
'
End Sub

TIA

Regards Bob C



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Indicating worksheets are hidden

True must be False in the code

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Robert Christie" wrote in message ...
Hi Ron

Had to re-word the MsgBox " are hidden to " visible"
As test of code on total 3 sheets with 2 hidden = 1 is
indicating open sheets.

Thankyou

Bob C.

-----Original Message-----
Try this

For Each sh In ThisWorkbook.Sheets
If sh.Visible = True Then hidcount = hidcount + 1
Next
AllSheets = ThisWorkbook.Sheets.Count
MsgBox "There are " & AllSheets & " sheets but " &

hidcount & " are hidden"


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Robert Christie"

wrote in message news:14a4901c3f929$18390030
...
Hi everyone
I have a one or two workbooks that have hidden sheets.
Can anyone help with a macro to indicate via a msgbox
that the workbook just opened contains hidden sheets.?
Is it possible to list the hidden sheet (Tab) names in
the msgbox.?

I tried to modify code I found on this site, which
informed the user, the sheet tab they had just click on
contained hidden rows

My code so far does not work, the msgbox shows up

whether
sheets are hidden or not.

Private Sub Workbook_Open()
'
On Error GoTo EndMacro:
If Me.ActiveWorkbook.Worksheets.Count < _
Me.ActiveWorkbook.Worksheets
(xlHidden).ActiveWorkbook.Worksheets.Count Then
MsgBox "This Workbook has Hidden Worksheets."
End If
EndMacro:
'
End Sub

TIA

Regards Bob C



.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Indicating worksheets are hidden

Robert,

Here is a slightly different approach...

'-------------------------
Sub FindHiddenSheets()
Dim objSht As Object

For Each objSht In Sheets
If Not objSht.Visible Then
Application.CommandBars.FindControl _
(ID:=30006).Controls("Sheet").Controls("Unhide..." ).Execute
Exit For
End If
Next 'Sht

Set objSht = Nothing
End Sub
'-------------------------

'Of course one could just go to Format | Sheet | Unhide and see if the menu item
is enabled.

Regards,
Jim Cone
San Francisco, CA

"Robert Christie" wrote in message
...
Hi everyone
I have a one or two workbooks that have hidden sheets.
Can anyone help with a macro to indicate via a msgbox
that the workbook just opened contains hidden sheets.?
Is it possible to list the hidden sheet (Tab) names in
the msgbox.?

I tried to modify code I found on this site, which
informed the user, the sheet tab they had just click on
contained hidden rows

My code so far does not work, the msgbox shows up whether
sheets are hidden or not.

Private Sub Workbook_Open()
'
On Error GoTo EndMacro:
If Me.ActiveWorkbook.Worksheets.Count < _
Me.ActiveWorkbook.Worksheets
(xlHidden).ActiveWorkbook.Worksheets.Count Then
MsgBox "This Workbook has Hidden Worksheets."
End If
EndMacro:
'
End Sub

TIA

Regards Bob C





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 117
Default Indicating worksheets are hidden

Hi Jim
Thankyou for your reply, works great, it's just a
reminder at the start that 2 or 3 sheets of 20 are
hidden, if you need to open one it's there at the start.

Regards
Bob C.

-----Original Message-----
Robert,

Here is a slightly different approach...

'-------------------------
Sub FindHiddenSheets()
Dim objSht As Object

For Each objSht In Sheets
If Not objSht.Visible Then
Application.CommandBars.FindControl _
(ID:=30006).Controls("Sheet").Controls

("Unhide...").Execute
Exit For
End If
Next 'Sht

Set objSht = Nothing
End Sub
'-------------------------

'Of course one could just go to Format | Sheet | Unhide

and see if the menu item
is enabled.

Regards,
Jim Cone
San Francisco, CA

"Robert Christie"

wrote in message
...
Hi everyone
I have a one or two workbooks that have hidden sheets.
Can anyone help with a macro to indicate via a msgbox
that the workbook just opened contains hidden sheets.?
Is it possible to list the hidden sheet (Tab) names in
the msgbox.?

I tried to modify code I found on this site, which
informed the user, the sheet tab they had just click on
contained hidden rows

My code so far does not work, the msgbox shows up

whether
sheets are hidden or not.

Private Sub Workbook_Open()
'
On Error GoTo EndMacro:
If Me.ActiveWorkbook.Worksheets.Count < _
Me.ActiveWorkbook.Worksheets
(xlHidden).ActiveWorkbook.Worksheets.Count Then
MsgBox "This Workbook has Hidden Worksheets."
End If
EndMacro:
'
End Sub

TIA

Regards Bob C



.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hidden Worksheets stew Excel Discussion (Misc queries) 6 February 26th 10 05:49 PM
Indicating Rows to Repeat At Top on all Worksheets Simultaneously Lilbit Excel Worksheet Functions 3 May 27th 08 01:23 PM
How do I detect hidden worksheets or hidden data on a worksheet? Alice Excel Discussion (Misc queries) 4 August 24th 06 03:38 AM
Worksheets hidden Jean-Pierre Hermans Excel Programming 2 January 18th 04 12:23 AM
Hidden worksheets Torbjörn Steijer Excel Programming 1 November 3rd 03 08:24 PM


All times are GMT +1. The time now is 04:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"