Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
caii
 
Posts: n/a
Default expand/collapse row button

can I place a button any where in the worksheet to collapse/expand rows? I
would like to place a button +/- on column D to expand/collapse row 2 to 5
(instead of using the grouping tool where you find the button at the left
most corner). Thank you for any assistance.

A B C D
row 1
row 2
row 3
row 4
row 5
--
caii
Excel 2003
  #2   Report Post  
Richard
 
Posts: n/a
Default expand/collapse row button

No need for a button

You could put the following code in the Worksheet_Selection Change
event. It will hide rows 2 to 5 whenever a cell in column D is
selected. Similarly it will unhide the rows if column E is selected

If you really want a button, simply use the same code in an attached
macro.

HTH

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Not Intersect(Target, [D:D]) Is Nothing Then
[2:5].Rows.Hidden = True
End If

If Not Intersect(Target, [E:E]) Is Nothing Then
[2:5].Rows.Hidden = False
End If

End Sub



caii wrote:
can I place a button any where in the worksheet to collapse/expand rows? I
would like to place a button +/- on column D to expand/collapse row 2 to 5
(instead of using the grouping tool where you find the button at the left
most corner). Thank you for any assistance.

A B C D
row 1
row 2
row 3
row 4
row 5
--
caii
Excel 2003


  #3   Report Post  
Gary76
 
Posts: n/a
Default expand/collapse row button

Have a look at Filter

You could put (say) and X in column D in the rows that you want hidden and
use Custom Filter on Columnd D (or on D1:D5) to display only cells that don't
contain X

Data Filter AutoFilter

HTH

Gary

"caii" wrote:

can I place a button any where in the worksheet to collapse/expand rows? I
would like to place a button +/- on column D to expand/collapse row 2 to 5
(instead of using the grouping tool where you find the button at the left
most corner). Thank you for any assistance.

A B C D
row 1
row 2
row 3
row 4
row 5
--
caii
Excel 2003

  #4   Report Post  
caii
 
Posts: n/a
Default expand/collapse row button

great and thanks, will try all your suggestions.
--
caii


"Gary76" wrote:

Have a look at Filter

You could put (say) and X in column D in the rows that you want hidden and
use Custom Filter on Columnd D (or on D1:D5) to display only cells that don't
contain X

Data Filter AutoFilter

HTH

Gary

"caii" wrote:

can I place a button any where in the worksheet to collapse/expand rows? I
would like to place a button +/- on column D to expand/collapse row 2 to 5
(instead of using the grouping tool where you find the button at the left
most corner). Thank you for any assistance.

A B C D
row 1
row 2
row 3
row 4
row 5
--
caii
Excel 2003

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
Command Button anomalies RWN Excel Discussion (Misc queries) 5 May 4th 05 05:09 AM
Command Button VBA code Dave Peterson Excel Discussion (Misc queries) 2 January 25th 05 11:28 PM
How to assign a macro to a commnd button Mickey Blue Eyes Excel Discussion (Misc queries) 2 January 4th 05 02:15 PM
command button moves Stuart Excel Discussion (Misc queries) 2 December 15th 04 05:56 PM
How do I setup a spin button in excel Andy K Excel Discussion (Misc queries) 1 November 26th 04 09:08 PM


All times are GMT +1. The time now is 08:58 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"