+ Reply to Thread
Results 1 to 10 of 10

How to hide and unhide rows from a click in the cell.

  1. #1
    Registered User
    Join Date
    06-04-2015
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    5

    How to hide and unhide rows from a click in the cell.

    I want to be able to double click on any cell in column ‘A’ and if there is a value in the cell, it checks for blanks below it and hides the following blank rows until it finds another cell that has a value in it. Than if double clicked in the same cell, it unhide the hidden rows. For example if I double click on A1, nothing happens but if I double click on A3, it hides rows 4 to 20 because the next cell in column ‘A’ that has value in it is row 21. Then if I double click A3 again, it unhide it. This same logic applies to column ‘B’ and ‘C” and so on. It can go up to 7 columns deep.



    Any help with this would be greatly appreciated.
    Attached Images Attached Images

  2. #2
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: How to hide and unhide rows from a click in the cell.

    Hi,
    Welcome to the forum.

    Try this............

    Right click on Sheet Tab --> View Code --> Paste the code given below in the code window --> Save your workbook as Macro-Enabled Workbook.
    Please Login or Register  to view this content.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  3. #3
    Registered User
    Join Date
    06-04-2015
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    5

    Re: How to hide and unhide rows from a click in the cell.

    sktneer,

    It didn't work. Is there anything else I can do.

  4. #4
    Registered User
    Join Date
    04-30-2015
    Location
    Oregon, USA
    MS-Off Ver
    2010
    Posts
    50

    Re: How to hide and unhide rows from a click in the cell.

    I just tested the code given with many different combinations of numbers and columns, and it worked great.
    Just make sure you're posting it in the Sheet's code, and not as a run-able macro.
    After pasting the code save as a Excel Macro-Enabled Workbook
    1.png2.png
    Last edited by Ajohn403; 06-04-2015 at 06:16 PM.

  5. #5
    Registered User
    Join Date
    06-04-2015
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    5

    Re: How to hide and unhide rows from a click in the cell.

    That was weird. Now it works great. Sktneer, thanks for writing the code and Ajohn403 thanks for trying it.

  6. #6
    Registered User
    Join Date
    06-04-2015
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    5

    Re: How to hide and unhide rows from a click in the cell.

    I just thought of another thing to help improve this function. When I double click on a cell and it hides the rows below it. Is it possible to turn that cell red so that it is clear that there as been rows hidden below it. Sorry to tag it along with this.

  7. #7
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: How to hide and unhide rows from a click in the cell.

    If that takes care of your original question, please mark your thread as Solved by selecting Thread Tools (just above your first post) --> Mark thread as solved.

  8. #8
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: How to hide and unhide rows from a click in the cell.

    Replace the existing code with the following one...
    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    06-04-2015
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    5

    Re: How to hide and unhide rows from a click in the cell.

    Nice! Very Nice. Thank you sktneer.

  10. #10
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,648

    Re: How to hide and unhide rows from a click in the cell.

    You're welcome.

    If that takes care of your original question, please mark your thread as Solved by selecting Thread Tools (just above your first post) --> Mark thread as solved.

+ 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. Double click to hide/unhide rows
    By Lilleyj in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 07-15-2014, 10:55 AM
  2. [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
  3. [SOLVED] First unhide all rows - then hide rows based on specific cell value for a range of cells
    By robbiekh in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-22-2013, 05:46 PM
  4. [SOLVED] Using Value in Cell to hide/unhide rows
    By maayub15 in forum Excel Formulas & Functions
    Replies: 29
    Last Post: 03-15-2012, 02:23 AM
  5. Unhide rows when you click a cell
    By lauren_roberts08 in forum Excel General
    Replies: 1
    Last Post: 06-13-2006, 03:30 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