+ Reply to Thread
Results 1 to 13 of 13

Double click to hide/unhide rows

  1. #1
    Registered User
    Join Date
    06-16-2014
    Location
    England
    MS-Off Ver
    2007
    Posts
    20

    Double click to hide/unhide rows

    Hi there,

    In row 4 I have my column headers, in column A I have the log number. I want to be able to double click on say log number 1 and all the rows (not including that row) to hide up to the row with log number 2 (not including). And then if I double click on log number 1 again the rows unhide. I would like this to happen to all log numbers and they may all have various numbers of rows below them, but column A of these rows will be empty up until the next log number.

    Is this possible?

    Many thanks in advance.

    Jess

  2. #2
    Forum Contributor
    Join Date
    08-15-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    349

    Re: Double click to hide/unhide rows

    Something like this;

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    06-16-2014
    Location
    England
    MS-Off Ver
    2007
    Posts
    20

    Re: Double click to hide/unhide rows

    Hi there,

    Sorry that doesn't seem to work. I have attached the template.

  4. #4
    Forum Contributor
    Join Date
    08-15-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    349

    Re: Double click to hide/unhide rows

    You can do the rest;

  5. #5
    Registered User
    Join Date
    06-16-2014
    Location
    England
    MS-Off Ver
    2007
    Posts
    20

    Re: Double click to hide/unhide rows

    Hi there,

    Thank you but is there a way that it can recognise itself how many rows to hide/unhide? I'd rather not have to add in extra coding everytime someone enters a new log number.

    Thanks

  6. #6
    Valued Forum Contributor Hawkeye16's Avatar
    Join Date
    02-27-2013
    Location
    Holland
    MS-Off Ver
    ├•┤ Pew Pew
    Posts
    441

    Re: Double click to hide/unhide rows

    This should work for you. It just looks for the range based on columns A and B after a double click in column A.
    Despite the high cost of living, it remains very popular.

    Don't forget to mark threads SOLVED when you get an answer and rep all the geniouses that helped you today!

  7. #7
    Valued Forum Contributor bulina2k's Avatar
    Join Date
    11-20-2012
    Location
    Urziceni, Ialomita, Romania
    MS-Off Ver
    2019 and 365
    Posts
    867

    Re: Double click to hide/unhide rows

    Try this way:

    Please Login or Register  to view this content.
    .. and don't forget to have fun!
    Bogdan.

    mark SOLVED and Add Reputation if my answer pleases you

  8. #8
    Valued Forum Contributor Hawkeye16's Avatar
    Join Date
    02-27-2013
    Location
    Holland
    MS-Off Ver
    ├•┤ Pew Pew
    Posts
    441

    Re: Double click to hide/unhide rows

    bulina - that does not account for the last occurrence (where there is not another instance below it in column A).

    My solution takes that into account.

  9. #9
    Valued Forum Contributor bulina2k's Avatar
    Join Date
    11-20-2012
    Location
    Urziceni, Ialomita, Romania
    MS-Off Ver
    2019 and 365
    Posts
    867

    Re: Double click to hide/unhide rows

    why should anyone double click last occurence? to hide what under ? but for editing purpose (using double-click) the next line can be inserted:

    Please Login or Register  to view this content.
    Last edited by bulina2k; 07-14-2014 at 08:47 AM.

  10. #10
    Valued Forum Contributor Hawkeye16's Avatar
    Join Date
    02-27-2013
    Location
    Holland
    MS-Off Ver
    ├•┤ Pew Pew
    Posts
    441

    Re: Double click to hide/unhide rows

    People do stuff that doesn't "make sense" all the time... which you find out the hard way when you start programming stuff for others to use.

    I am also not sure how yours account for a click that is not on an actual number (just hides the rows between the click and next occurrence?)

  11. #11
    Valued Forum Contributor bulina2k's Avatar
    Join Date
    11-20-2012
    Location
    Urziceni, Ialomita, Romania
    MS-Off Ver
    2019 and 365
    Posts
    867

    Re: Double click to hide/unhide rows

    Quote Originally Posted by Hawkeye16 View Post
    ...
    I am also not sure how yours account for a click that is not on an actual number (just hides the rows between the click and next occurrence?)
    no. it works as it should: first it finds the next occurence (nextR = Target.End(xlDown).Row)
    give it a try!

  12. #12
    Valued Forum Contributor Hawkeye16's Avatar
    Join Date
    02-27-2013
    Location
    Holland
    MS-Off Ver
    ├•┤ Pew Pew
    Posts
    441

    Re: Double click to hide/unhide rows

    After looking at your code, I think we interpreted different things. I think he wanted to double click #1 and hide the detail lines of #1 (between #1 and #2) and you wrote code to click on #1 and hide everything below #2 but leave the detail for #1.

    I understand what you are doing better now, I was reading your code expecting a different result so it looked wrong when it wasn't for the result you expected

    Either way, one of our answers should work for the OP.

  13. #13
    Registered User
    Join Date
    06-16-2014
    Location
    England
    MS-Off Ver
    2007
    Posts
    20

    Re: Double click to hide/unhide rows

    Hawkeye16 yours works exactly how i was hoping. Thank you so much

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Hide And Unhide Column With One Button,,,,Once Click Hide,,,,,Again Click Unhide
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-11-2014, 07:58 AM
  2. [SOLVED] VBA for HIDE/UNHIDE Colum when press double click
    By santosh226001 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-09-2013, 06:26 AM
  3. Disable Hide/Unhide from Format, and right click on Row and Column
    By lejlasehic in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-16-2013, 07:05 AM
  4. [SOLVED] need to hide / unhide cells with single click
    By SBURTON in forum Excel General
    Replies: 2
    Last Post: 09-25-2012, 03:00 PM
  5. click - hide/unhide column
    By sqoo in forum Excel General
    Replies: 7
    Last Post: 11-28-2011, 04:48 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1