View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Patrick C. Simonds Patrick C. Simonds is offline
external usenet poster
 
Posts: 343
Default Code runs to slow

Thank you sir.

Having never used Filters before, I spent some time in the help files
learning how to use Filters, and I have to say it is much fast.



"Dave Peterson" wrote in message
...
Have you thought about just using Data|Filter|Autofilter the range (column
J)
and showing all the rows that don't have the cell in column J equal to 0?

"Patrick C. Simonds" wrote:

We have a spreadsheet into which we dump a large amount of data
(averaging
around 55,000+ rows). We then use formulas to detect error in the data so
that we can go back into the original program and correct those errors.
What
the code below does (my thanks to Rick Rothstein, MVP -VB) is hides all
rows
which do not have errors leaving only the rows with errors (saves one
from
having to scroll through more than 55,000 rows in search of errors).

My problem is that it takes to long to hide the rows (in excess of 5
minutes). Does anyone have any thoughts on how to speed up the process?

Sub HideRowIfZeroInG()
'
'
Application.ScreenUpdating = False

Dim R As Range
Dim LastRow As Long
With Worksheets("Negative Miles and Missing Perf")
LastRow = .Cells(Rows.Count, "J").End(xlUp).Row
If LastRow 65536 Then LastRow = 65536
For Each R In .Range("J3:J" & CStr(LastRow))
If R.Value = 0 And R.Value < "" Then R.EntireRow.Hidden = True
Next
End With

Application.ScreenUpdating = True

End Sub


--

Dave Peterson