If Statements to Unhide Sheets

b_choplick

New Member
Joined
Jul 17, 2014
Messages
9
I am writing a macro that checks the value of specific cells on a sheet titled 1-SUMMARY and unhides specific sheets if the value of the cell is greater than $0.00.
 
Last edited:

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Can't see anything obvious in your code that causes the error, I'd check the sheet names match your code exactly, usually a typo causes problems. Here's how I'd write your code, it may or may not work. Also, what sheet is Range("C10") etc on? It's not clear from your code if it's the activesheet and that too may cause a problem. Change the part in red for whatever sheet contains Range("C10")
Rich (BB code):
Sub GenerateLOA_v1()

Dim ws As Worksheet

Application.ScreenUpdating = False

For Each ws In Worksheets
    Select Case ws.Name
        Case "LOA", "Cover Letter", "W-9", "T&C", "Exhibit A Cover", "1-SUMMARY"
            ws.Visible = True
        Case Else
            ws.Visible = False
    End Select
Next ws

With Sheets("1-SUMMARY")
  If .Range("C10").Value > 0 Then Sheets("Exhibit A DwellLighting").Visible = True
  If .Range("C11").Value > 0 Then Sheets("Exhibit A ExtLighting").Visible = True
  If .Range("C12").Value > 0 Or .Range("C13").Value > 0 Or .Range("C26").Value > 0 Or .Range("C38").Value > 0 Then _
    Sheets("Exhibit A Weatherization").Visible = True
  If .Range("C15").Value > 0 Then Sheets("Exhibit A Refrigerator").Visible = True
  If .Range("C18").Value > 0 Or .Range("C19").Value > 0 Or .Range("C29").Value > 0 Or .Range("C41").Value > 0 Then _
    Sheets("Exhibit A Windows").Visible = True
  If Activesheet.Name <> .Name Then .Select
End With

Application.ScreenUpdating = True

End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

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