+ Reply to Thread
Results 1 to 10 of 10

Vba code to hide specific cells

Hybrid View

  1. #1
    Valued Forum Contributor rollis13's Avatar
    Join Date
    01-26-2012
    Location
    Cordenons
    MS-Off Ver
    Excel 2016 32bit - Win 11
    Posts
    935

    Re: Vba code to hide specific cells

    Just a hint, it might work. Try splitting row ranges and skip subcategory rows; here's the example for the main category POWERTRAIN:
    Sub TogglePowertrain()
        With Worksheets("Codes")
            .Rows("175:188").Hidden = Not .Rows("175:188").Hidden
            .Rows("190:216").Hidden = Not .Rows("190:216").Hidden
        End With
    End Sub
    Last edited by rollis13; 03-08-2024 at 06:15 PM.
    Difficult is not to know but to share what you know (Han Fei Tzu reworked)

  2. #2
    Registered User
    Join Date
    03-08-2024
    Location
    Mexico
    MS-Off Ver
    Office 365
    Posts
    8

    Re: Vba code to hide specific cells

    Hi

    Your solution was worked partially, the thing now is that when not toggled, the Main category button already deploy the Sub categories buttons, when the desire is to show the Sub categories only when toggling the Main Categories. Here´s the "ideal sequence":

    1. When not toggled, the only thing appearing in screen are the 4 Main Categories buttons (Body, Chassis, Electrical & Powertrain).

    2 When toggling a certain Main Category button, the cells to appear have to be only the Sub Categories buttons. (Taking as an example the Electrical, the only cells that must appear when toggling are rows 134,150,163).

    Your solution has already helped me a lot! Just wondering what change must be applied to you code in order to have the desired sequence...

  3. #3
    Registered User
    Join Date
    03-08-2024
    Location
    Mexico
    MS-Off Ver
    Office 365
    Posts
    8

    Re: Vba code to hide specific cells

    Quote Originally Posted by rollis13 View Post
    Just a hint, it might work. Try splitting row ranges and skip subcategory rows; here's the example for the main category POWERTRAIN:
    Sub TogglePowertrain()
        With Worksheets("Codes")
            .Rows("175:188").Hidden = Not .Rows("175:188").Hidden
            .Rows("190:216").Hidden = Not .Rows("190:216").Hidden
        End With
    End Sub
    ---------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Hi

    Your solution was worked partially, the thing now is that when not toggled, the Main category button already deploy the Sub categories buttons, when the desire is to show the Sub categories only when toggling the Main Categories. Here´s the "ideal sequence":

    1. When not toggled, the only thing appearing in screen are the 4 Main Categories buttons (Body, Chassis, Electrical & Powertrain).

    2 When toggling a certain Main Category button, the cells to appear have to be only the Sub Categories buttons. (Taking as an example the Electrical, the only cells that must appear when toggling are rows 134,150,163).

    Your solution has already helped me a lot! Just wondering what change must be applied to you code in order to have the desired sequence...

+ 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/Unhide Scroll Bars Code for Specific Sheets
    By crazyforexcel in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-21-2019, 09:28 AM
  2. Help with ToggleButton VBA code to hide/show specific worksheets
    By aprilnparker in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-14-2018, 03:04 PM
  3. VBA code for Checkbox to hide and unhide rows by a specific name
    By NichlasO in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-19-2017, 12:38 PM
  4. [SOLVED] Need code to hide specific rows based on different cell value
    By majzeln in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-04-2016, 02:02 PM
  5. code to hide specific rows
    By kosherboy in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-23-2016, 11:05 AM
  6. Would like to hide specific text inside macro vba code
    By keisen in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-24-2015, 07:08 PM
  7. [SOLVED] Specific macro or VBA code to hide and unhide rows
    By louvaek in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 11-17-2014, 07:36 AM

Tags for this Thread

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