Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 138
Default VBA to hide rows?

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default VBA to hide rows?

Hi S Davis

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



--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"S Davis" wrote in message oups.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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 138
Default VBA to hide rows?


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 -


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default VBA to hide rows?

You can use this

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


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"S Davis" wrote in message ups.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 -


  #5   Report Post  
Posted to microsoft.public.excel.programming
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 -


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Group rows (or hide rows) like in MS Project Annie1904 Excel Worksheet Functions 2 October 17th 09 05:15 AM
Macro code to hide rows and not calculate hidden rows bradmcq Excel Discussion (Misc queries) 0 September 1st 09 12:38 AM
Enabling option „Format rows“ to hide/unhide rows using VBA-code? ran58 Excel Discussion (Misc queries) 0 July 28th 09 03:46 PM
cut rows without cutting hide rows מיכל Excel Discussion (Misc queries) 1 June 25th 07 02:01 PM
Hide Rows - copy and paste only rows that show Access101 Excel Worksheet Functions 3 March 1st 06 12:39 AM


All times are GMT +1. The time now is 10:49 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"