Hide unhide sheets

  • Thread starter Thread starter Reijer
  • Start date Start date
R

Reijer

Hello Excellers,

With a value in cel B23 on every sheet i want to hide or unhide the sheets.
Standard they are hidden when i start. Who can help me with a procedure for
this pls?

Greetings,

Reijer.
 
Reijer:

You can hide/unhide sheets with the following VBA command

activesheet.visible=true/false.

So to go thru all the worksheets in a workbook and check depending on if
there is a value in B23:

Option Explicit

Sub CheckAllWorksheets()

Dim ws As Worksheet

For Each ws In ActiveWorkbook.Worksheets
If ws.Range("B23").Value <> "" Then
ws.Visible = xlSheetVisible
Else
ws.Visible = xlSheetHidden
End If
Next ws

End Sub
 

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

Similar Threads

Expand and collapse rows 7
Valua of a cel as message in a MsgBox 4
Hide/unhide 4
Hide/Unhide Sheet Macro 6
Block a sheet from being unhidden 2
Autofilter 2
Change valua into text ? 2
Hide Unhide Button 4

Back
Top