Hide/Unhide Code

  • New/Beginner in VBA here -- in one of my workbook sheets, I have two dropdowns in two different cells (named the cells "Unit_Mix_Option" and "Ops Option") where I can select certain text (either "simple" or "detailed"). When I select "detailed", I want it to pull up different sheets listed below. However, I believe that the code I'm using below (I just added this code by right-clicking on the tab and adding it to the "view code" section) is causing my workbook to become unstable. After adding it, I'm finding that my excel freezes when I open up some grouped cells on a different sheet (never happened before adding this code). Do you think that the way its written below is causing this separate issue in another part of my workbook? If so, is there another way for me to code this?

  • Welcome to the Forum. Please read the Forum Rules to understand how the Forum works and why I have added Code Tags to your post

    All VBA code posted in the forum must be wrapped in code tags, which you omitted, including single-line code snippets.Be sure to use them in future posts.

    How to use code tags

    Note: no apostrophe in the tags, just used for demonstration here.


    your code goes between these tags


    Or, just highlight all of the code and press the <> in the post menu above button to add the code tags.


  • Try this code

  • Thanks a lot for your responses Roy! Really appreciate it.

    I have been playing with the file, and I agree now that it my ungroup problem doesn't appear to be associated with the vba code. Thanks for the alternate code; I may try it if I have any problems -- do you know if one or the other of these codes is less resource intensive? Thanks again!

    However, with the grouping/ungrouping issue, I noticed something very strange -- when I ungroup the cells, it only freezes when I'm scrolled all the way to the left side of the page, and only when I use my main monitor. If I scroll over the right of the excel sheet, and then ungroup the cells by pressing the "+" sign, it works. If I'm over to the left and press the "+" sign, it freezes up. ALSO, if I move the entire workbook over to my secondary monitor, I have no problems grouping/ungrouping those cells at all. This is very bizarre, and I've never experienced anything like it. Do you have any thoughts on what could be causing this issue?

  • I don't think either set of code will cause problems. My code just shows an alternative way to do it.

    The grouping issue must be caused by dual monitors. I haven't come across ths but I don't often use two monitors.

  • Gotcha, thanks again for your help! I might pose this grouping question in the general forum because I can't find anything on it. Oddly, this isn't a problem on my main monitor either as long as I don't have the excel window maximized...very odd.

  • royUK

    Closed the thread.