View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
S Davis S Davis is offline
external usenet poster
 
Posts: 138
Default VBA to hide rows?

Fantastic Ron, thanks again!

On Jan 24, 1:39 pm, "Ron de Bruin" wrote:
You can use this

Range("A8,A10,a12").EntireRow.Hidden = True

--

Regards Ron de Bruinhttp://www.rondebruin.nl/tips.htm



"S Davis" wrote in oglegroups.com...

Thanks, thats great :) Works perfect.


Is there anything more elegant than the following for what I would like
to do? Id like to avoid the 'stepladder' visual that occurs when trying
to hide various rows.


ShowRows() essentially shows everything and then hides the ones I dont
want seen. Id prefer to do something like


Rows(8 & 10 & 12......).Hidden = False


but this is not accepted.


Ex (my code)
Sub HideRows()
Rows(5 & ":" & 42).Hidden = True
End Sub
Sub ShowRows()
Rows(1 & ":" & 42).Hidden = False
Rows(8).Hidden = True
Rows(10).Hidden = True
Rows(12).Hidden = True
Rows(14).Hidden = True
Rows(16).Hidden = True
Rows(18).Hidden = True
Rows(20).Hidden = True
Rows(22).Hidden = True
Rows(27).Hidden = True
Rows(29).Hidden = True
Rows(35).Hidden = True
Rows(37).Hidden = True
Rows(39).Hidden = True
Rows(41).Hidden = True
Rows(42).Hidden = True
End Sub


Thanks
-SD
On Jan 24, 12:32 pm, "Ron de Bruin" wrote:
Hi S Davis


Rows(5 & ":" & 35).Hidden = True


--


Regards Ron de Bruinhttp://www.rondebruin.nl/tips.htm


"S Davis" wrote in ooglegroups.com...
Hello,


If possible, I would like a simple button to hide & show a set number
of rows (rows 5 - 35). Can this be done?


Thanks
-SD- Hide quoted text -- Show quoted text -- Hide quoted text -- Show quoted text -