Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Bob is offline
external usenet poster
 
Posts: 972
Default Toggling xlVeryHidden

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,069
Default Toggling xlVeryHidden

Try

Sub HideUnhide()
With Sheets("Sheet2")
If (.Visible = xlVeryHidden) Or (.Visible = False) Then
.Visible = True
Else
.Visible = xlVeryHidden
End If
End With
End Sub

Hope this helps,

Hutch

"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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Toggling xlVeryHidden

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 464
Default Toggling xlVeryHidden

Use the Sheet CodeName.

Sub HideUnhide()
'Use Sheet CodeName
'http://www.ozgrid.com/VBA/excel-vba-sheet-names.htm
Sheet2.Visible = Not _
Sheet2.Visible = xlSheetVeryHidden
End Sub


--
Regards
Dave Hawley
www.ozgrid.com
"Jacob Skaria" wrote in message
...
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


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Toggling xlVeryHidden

Dave, how does that toggle between xlSheetVERYHidden and xlSheetVisible?

--
Jacob (MVP - Excel)


"ozgrid.com" wrote:

Use the Sheet CodeName.

Sub HideUnhide()
'Use Sheet CodeName
'http://www.ozgrid.com/VBA/excel-vba-sheet-names.htm
Sheet2.Visible = Not _
Sheet2.Visible = xlSheetVeryHidden
End Sub


--
Regards
Dave Hawley
www.ozgrid.com
"Jacob Skaria" wrote in message
...
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




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 464
Default Toggling xlVeryHidden

It doesn't :) Should be;

Sub HideUnhide()
With Sheet2
If .Visible = True Then
.Visible = xlSheetVeryHidden
Else
.Visible = True
End If
End With
End Sub

I was just trying to avoid the IIf, and use the CodeName so users cannot
break the macro by renaming or moving the Sheet. I have read on the MS site
somewhere that's it rather clunky compared to If Else statements. I.e looks
can be deceiving :)



--
Regards
Dave Hawley
www.ozgrid.com

"Jacob Skaria" wrote in message
...
Dave, how does that toggle between xlSheetVERYHidden and xlSheetVisible?

--
Jacob (MVP - Excel)


"ozgrid.com" wrote:

Use the Sheet CodeName.

Sub HideUnhide()
'Use Sheet CodeName
'http://www.ozgrid.com/VBA/excel-vba-sheet-names.htm
Sheet2.Visible = Not _
Sheet2.Visible = xlSheetVeryHidden
End Sub


--
Regards
Dave Hawley
www.ozgrid.com
"Jacob Skaria" wrote in message
...
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



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

Tom - That did the trick. Thanks!

Regards,
Bob


"Tom Hutchins" wrote:

Try

Sub HideUnhide()
With Sheets("Sheet2")
If (.Visible = xlVeryHidden) Or (.Visible = False) Then
.Visible = True
Else
.Visible = xlVeryHidden
End If
End With
End Sub

Hope this helps,

Hutch

"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

  #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

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

Dave - Thanks for your help! I really appreciate it.

Regards,
Bob


"ozgrid.com" wrote:

It doesn't :) Should be;

Sub HideUnhide()
With Sheet2
If .Visible = True Then
.Visible = xlSheetVeryHidden
Else
.Visible = True
End If
End With
End Sub

I was just trying to avoid the IIf, and use the CodeName so users cannot
break the macro by renaming or moving the Sheet. I have read on the MS site
somewhere that's it rather clunky compared to If Else statements. I.e looks
can be deceiving :)



--
Regards
Dave Hawley
www.ozgrid.com

"Jacob Skaria" wrote in message
...
Dave, how does that toggle between xlSheetVERYHidden and xlSheetVisible?

--
Jacob (MVP - Excel)


"ozgrid.com" wrote:

Use the Sheet CodeName.

Sub HideUnhide()
'Use Sheet CodeName
'http://www.ozgrid.com/VBA/excel-vba-sheet-names.htm
Sheet2.Visible = Not _
Sheet2.Visible = xlSheetVeryHidden
End Sub


--
Regards
Dave Hawley
www.ozgrid.com
"Jacob Skaria" wrote in message
...
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



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
xlVeryHidden Mike H. Excel Programming 5 November 10th 08 07:35 PM
Xlveryhidden K1KKKA Excel Discussion (Misc queries) 9 October 6th 07 04:19 AM
opposite of XLVeryhidden!! roshinpp_77[_5_] Excel Programming 4 June 5th 06 12:54 PM
XLVERYHIDDEN Sunil Patel Excel Programming 1 July 13th 05 10:41 PM
Doing something wrong - xlVeryHidden Kevin Excel Programming 6 May 31st 04 12:22 AM


All times are GMT +1. The time now is 05:59 PM.

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

About Us

"It's about Microsoft Excel"