Excel VBA hide rows based on cell value update

Stuepef

Board Regular
Joined
Oct 23, 2017
Messages
128
Office Version
  1. 2021
Platform
  1. Windows
I have a code that looks at Sheet4 cell A11 and if that cell is blank, hide the entire sheet. If cell A11 is NOT blank, then leave the the sheet visible, but I am looking to update this part of the code. Details:

If Sheet4 cell A11 is blank, then hide the sheet.

If Sheet2 cell A11 is not blank, go through range A11:A60 and hide every row thats blank.

Current Code:
Code:
Sub HideBasePlanTab()
Dim oneSheet As Variant

For Each oneSheet In Array(Sheet4)
    With oneSheet
        .Visible = IIf(.Range("A11") = "", xlSheetHidden, xlSheetVisible)
    End With
Next oneSheet
End Sub

Thank you!
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top