I have working code to hide/unhide rows depending on the corresponding cell value.
This is a list of materials and there is a 'finalize' button. You press the button and any row where quantity = 0 should be hidden.
There are 400+ lines and I can see the lines disappear. It is processing roughly 20 lines per second which makes it over 20 seconds to do the list. The list will double every few months.
Is there another method that will hide the lines faster?
Hide:
Public Sub HideRows()
Dim cell As Range
For Each cell In ActiveSheet.Range("H18:H469")
cell.EntireRow.Hidden = (cell.Value = 0 And cell.Value <> "")
Next cell
End Sub
Unhide:
Public Sub UnhideRows()
Dim cell As Range
For Each cell In ActiveSheet.Range("H18:H469")
If (cell.Value = 0 And cell.Value <> "") Then cell.EntireRow.Hidden = False
Next cell
End Sub
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…