+ 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

    Try with these other tweaks (example for POWERTRAIN):
    Sub TogglePowertrain()
        With Worksheets("Codes")
            If .Rows("175").Hidden = True And .Rows("190").Hidden = True Then
                .Rows("174").Hidden = Not .Rows("174").Hidden
                .Rows("189").Hidden = Not .Rows("189").Hidden
            End If
            If .Rows("175").Hidden = False Then
                .Rows("175:188").Hidden = True
            End If
            If .Rows("190").Hidden = False Then
                .Rows("190:199").Hidden = True
            End If
        End With
    End Sub
    and these others respectively modified as follows:
    Sub TogglePowertrain_EngineCooling()
        With Worksheets("Codes")
            .Rows("175:188").Hidden = Not .Rows("175:188").Hidden
        End With
    End Sub
    
    Sub TogglePowertrain_Manual()
        With Worksheets("Codes")
            .Rows("190:199").Hidden = Not .Rows("190:199").Hidden
        End With
    End Sub
    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

    Quote Originally Posted by rollis13 View Post
    Try with these other tweaks (example for POWERTRAIN):
    Sub TogglePowertrain()
        With Worksheets("Codes")
            If .Rows("175").Hidden = True And .Rows("190").Hidden = True Then
                .Rows("174").Hidden = Not .Rows("174").Hidden
                .Rows("189").Hidden = Not .Rows("189").Hidden
            End If
            If .Rows("175").Hidden = False Then
                .Rows("175:188").Hidden = True
            End If
            If .Rows("190").Hidden = False Then
                .Rows("190:199").Hidden = True
            End If
        End With
    End Sub
    and these others respectively modified as follows:
    Sub TogglePowertrain_EngineCooling()
        With Worksheets("Codes")
            .Rows("175:188").Hidden = Not .Rows("175:188").Hidden
        End With
    End Sub
    
    Sub TogglePowertrain_Manual()
        With Worksheets("Codes")
            .Rows("190:199").Hidden = Not .Rows("190:199").Hidden
        End With
    End Sub
    --------------------------------------------------------------------------------------------------------------------------------------------

    Thanks a lot! I´ve applied to all respective cells and now the whole file is toggling as desired. Much appreciated.

+ 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