Is there a "go faster" option to hide rows

Dav1d

New Member
Joined
Sep 27, 2010
Messages
27
I'm working with a form that can have varying rows of data. There will come a time when I want to archive them according to a criteria ("3" in Column A). The code I'm using is below

My problem is its going really, really slow, even when working through 10 or so lines. Is there a tip that might speed things up?

Sub NewArchive()
For Each cell In ActiveSheet.Range("A17:A500")
If cell.Value = "3" Then cell.EntireRow.Hidden = True
Next
End Sub



Many thanks guys!
David
 
If your headers are in row 16 (as I'm guessing), here's a method using advanced filter, which might be faster than the previous version for larger datasets.

End Sub[/CODE]

Many thanks, Weaver. I really appreciate the help. I also appreciate the advice viz, the way to really learn excel.
 
Upvote 0

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Wow! That was fast! Many thanks Rick.
You are welcome. I may have left out an error checking line that you might need. If your data is guaranteed to always have at least one cell in Column A (Row 17 and beyond) with a 3 in it, then you can ignore the following. However, if it is possible to have no 3's in that range, then you need to add this...

Code:
On Error Resume Next
immediately before the SpecialCells code line to protect against the error that would be generated if that function finds no elements.
 
Upvote 0

Forum statistics

Threads
1,225,156
Messages
6,183,227
Members
453,152
Latest member
ChrisMd

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