View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Bob Bob is offline
external usenet poster
 
Posts: 972
Default Toggling xlVeryHidden

Jacob - Thanks for your help! Being a relative novice to VBA I am not
familiar with "IIF" and need to read up on it. I like your efficient code.
Thanks again!

Regards,
Bob


"Jacob Skaria" wrote:

Bob, try the below..

Sub HideUnhide()
Sheets("Sheet2").Visible = IIf(Sheets("Sheet2").Visible = _
True, xlSheetVeryHidden, True)
End Sub

--
Jacob (MVP - Excel)


"Bob" wrote:

I am trying to write a macro for use in Excel 2003 & 2007 that will toggle
between hiding (using xlVeryHidden) and unhiding a specific worksheet
(Sheet2).

I know how to perform a "normal" hide/unhide using the following code:

Sub HideUnhide()
Sheets("Sheet2").Visible = Not _
Sheets("Sheet2").Visible
End Sub

But I don't know how to incorporate xlVeryHidden. I would greatly
appreciate any help.

Thanks,
Bob