Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel: collapsing/expanding rows by double clicking cell

Status
Not open for further replies.

tankthefrank

Technical User
Jun 19, 2009
9
AU
hi folks,

I'm pretty retarded when it comes to excel which after 10 yrs of using is pretty poor.

Objective: create a cascading look across a s/s.
I want the user of the s/s to double click on a cell (NOT THE COLLAPSE/EXPAND button in groupings) to expand additional rows, and vice versa collapse by double clicking the same cell. The cell i'm referring to is a few columns in hence why i don't want to use the collapse/expand buttons from groupings.
Big boss wants something funky which i'm not entirely great at delivering so any help with this would be great.
If you know a cool way of getting that cascading look (without merging cells together) please let me know. Much appreciated
 
I don't what you mean by "that cascading look", but expanding collapsing groupings is very easy to trigger on a double-click.

Right-click the sheet tab and choose View Code, and paste this code into the code pane:
Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    ActiveSheet.Rows(Target.Row).ShowDetail = Not ActiveSheet.Rows(Target.Row).ShowDetail
End Sub

By the way, if you have any VBA queries I recommend posting in the VBA forum forum707 in the future.

Cheers, Glenn.

Beauty is in the eye of the beerholder.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top