chuckdanger
New Member
- Joined
- Apr 27, 2015
- Messages
- 7
Hi, attempted to create a code to hide all "0" cell rows in a given column. These cells consist of a lookup seeking mail dates that have not occurred yet in data, so they are returning a 1/0/1900 value for the time being. Came up with the following code. I am not liking the run time on it and would appreciate input on how to make it more efficient. The column range "lr" never exceeds 1000, if that's a reference point.
Code:
Sub HideEmpties()
Dim lr As String
StartTime = Timer
Application.Calculation = xlManual = True
lr = Range("J" & Rows.Count).End(xlUp).Row
Dim cell As Range
For Each cell In Range("J1:J" + lr)
cell.EntireRow.Hidden = cell.Value = 0
Next cell
Application.Calculation = xlAutomatic = True
MinElapsed = Format((Timer - StartTime) / 86400, "hh:mm:ss")
MsgBox "This code ran successfully in " & MinElapsed & " minutes", vbInformation
End Sub
Last edited: