VeryHideWorksheet With a Macro? .... or even normal hide?

  • Thread starter Thread starter dimm
  • Start date Start date
D

dimm

Hi,

Can someone tell me how to VeryHide and also to make a worksheet visible
again using VBA?

If thats not possible can I just regular hide and unhide a worksheet using
VBA?

Thanks for any advice.
 
Sub hide_em()
Dim n As Single
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
If Not ws.Name = "hoohah" Then
ws.Visible = xlVeryHidden
End If
Next ws
End Sub

Sub unhide_em()
Dim n As Single
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
ws.Visible = True
Next ws
End Sub

To hide a single sheet or selected sheets...............

Sub hidesome()
ActiveWindow.SelectedSheets.Visible = xlVeryHidden
End Sub


Gord Dibben MS Excel MVP
 
Hi,

Can someone tell me how to VeryHide and also to make a worksheet visible
again using VBA?

If thats not possible can I just regular hide and unhide a worksheet using
VBA?

Thanks for any advice.

dimm,

You can use the ActiveSheet.Visible = xlVeryHidden property, or you
can also refer to sheets by name, for example:

Sub HideSheet()
Worksheets("Sheet1").Visible = xlVeryHidden
End Sub

Sub UnHideSheet()
Worksheets("Sheet1").Visible = xlVisible
End Sub

You can then adapt this basic structure to meet your own needs.

Alex
 
xlVeryHidden does not show up in the Hide list, such as when you go to
Unhide a worksheet there is a list populated with all of the hidden sheets.
veryhidden does not show up in that group, but it is visible in the VBIDE.
 

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