+ Reply to Thread
Results 1 to 2 of 2

Keeping rows hidden when using a toggle button

  1. #1
    Registered User
    Join Date
    12-09-2022
    Location
    Redditch
    MS-Off Ver
    2210
    Posts
    2

    Keeping rows hidden when using a toggle button

    Hi,

    I'm having issues with trying to ensure that certain rows I have hidden using another toggle button which should only appear when selecting the 'here' button. These are within a main drop down commanded by another toggle button and whenever I select "show rows" that I have coded the rows that I want to remain hidden are revealed. I'm quite new to the coding elements of excel and I'm sure it's n easy fix but haven't been able to find a solution.

    My current codes are below:

    Private Sub ToggleButton4_Click()

    Dim xAddress As String
    Dim splitAddress As Variant
    xAddress = "87:126" 'change this to the row numbers
    splitAddress = Split(xAddress, ",")

    If ToggleButton4.Value Then
    For Each Var In splitAddress
    Application.ActiveSheet.Rows(Var).Hidden = True
    ToggleButton4.Caption = "Show Rows"
    Next Var

    Else
    For Each Var In splitAddress
    Application.ActiveSheet.Rows(Var).Hidden = False
    ToggleButton4.Caption = "Hide Rows"
    Next Var

    End If
    End Sub

    Private Sub ToggleButton5_Click()

    Dim xAddress As String
    Dim splitAddress As Variant
    xAddress = "90:94" 'change this to the row numbers
    splitAddress = Split(xAddress, ",")

    If ToggleButton5.Value Then
    For Each Var In splitAddress
    Application.ActiveSheet.Rows(Var).Hidden = True
    ToggleButton5.Caption = "here"
    Next Var

    Else
    For Each Var In splitAddress
    Application.ActiveSheet.Rows(Var).Hidden = False
    ToggleButton5.Caption = "here"
    Next Var

    End If

  2. #2
    Forum Contributor Dante Amor's Avatar
    Join Date
    07-24-2020
    Location
    MEXICO
    MS-Off Ver
    Excel 2013
    Posts
    212

    Re: Keeping rows hidden when using a toggle button

    Try this:

    Please Login or Register  to view this content.

+ 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. Keeping rows hidden when using a toggle button
    By EDM_173 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-10-2022, 02:02 PM
  2. How to hide some rows based on a specific cell value whilst keeping all unused rows hidden
    By Consultant101 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-15-2021, 06:41 PM
  3. Toggle Hidden/View Rows VBA
    By Lmao in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-01-2017, 11:08 AM
  4. Keeping Hidden Rows Hidden when Copying
    By k64 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-29-2015, 10:58 AM
  5. Adding Toggle to Hidden Rows Sheet
    By tkbulldog in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-29-2011, 12:27 AM
  6. Replies: 2
    Last Post: 02-13-2011, 01:22 PM
  7. Keeping Hidden Rows/Columns Hidden?
    By DMac in forum Excel General
    Replies: 0
    Last Post: 01-17-2005, 08:13 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