mistatasty
New Member
- Joined
- Jul 21, 2021
- Messages
- 23
- Office Version
- 365
- Platform
- Windows
I have a table where I need to hide the rows if the values in A24:A247 are either "0" or have the text "(blank)" in them. For some reason this code only hides rows with 0's and not the "(blank)"s. Anyone know why?
Private Sub Worksheet_Calculate()
Dim c As Range
Application.EnableEvents = False
For Each c In Range("A23:A247")
c.EntireRow.Hidden = c.Value = "(blank)"
Next
For Each c In Range("A23:A247")
c.EntireRow.Hidden = c.Value = "0"
Next
Range("A:B").EntireColumn.AutoFit
Range("D:AN").EntireColumn.AutoFit
For Each c In Range("e23:an23")
c.EntireColumn.Hidden = c.Value = "0"
Next
Application.EnableEvents = True
End Sub
Private Sub Worksheet_Calculate()
Dim c As Range
Application.EnableEvents = False
For Each c In Range("A23:A247")
c.EntireRow.Hidden = c.Value = "(blank)"
Next
For Each c In Range("A23:A247")
c.EntireRow.Hidden = c.Value = "0"
Next
Range("A:B").EntireColumn.AutoFit
Range("D:AN").EntireColumn.AutoFit
For Each c In Range("e23:an23")
c.EntireColumn.Hidden = c.Value = "0"
Next
Application.EnableEvents = True
End Sub