View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Martin Fishlock[_4_] Martin Fishlock[_4_] is offline
external usenet poster
 
Posts: 32
Default Hiding Rows in a Range based on column A value

There is one tweek that you can play around with in VBA/excel:

at the start of the sub include:

Application.ScreenUpdating = false


and at the end of the sub include (if you are in 2002+ then it is very
important to include this):

Application.ScreenUpdating = true

Excel before 2002 automatically turned screenupdating back on at the end of
macro now it does not and if you halt your code or you get exceptions you
need to write a little macro that will turn it back on and keep it in your
personal:

sub TurnScreenUpdatingOn()
Application.ScreenUpdating = true
end sub

The other area is in code optimisation. Display your code I will review it
or someone else will if I've gone to bed. LOL 21:30 here.LOL

--
HTHs Martin


"tig" wrote:

Martin,

Thank you for the reply. The method you gave me works pretty well. So
I'm a little better off than I was earlier. The only problem is that
the range is usually over 1000 rows. So it takes quite a while to go
through the loop.

Any ideas on speeding it up?? One thing I thought of was to create a
named range with the rows with column A = 1, then I could just do
Range("test").Rows.Hidden = True.

My problem is I'm not sure if I can programmatically populate a named
range in a loop like that. And who knows, it might not even be much
faster.

Let me know if you have any further insights.

Thanks again.