Results 1 to 3 of 3

Checkbox Macro to Hide/Unhide Rows Not Working Properly

Threaded View

  1. #1
    Registered User
    Join Date
    09-29-2020
    Location
    Washington, DC
    MS-Off Ver
    MS Office 365
    Posts
    2

    Question Checkbox Macro to Hide/Unhide Rows Not Working Properly

    I have a checkbox that I am trying to use to hide and unhide rows. The rows start off hidden, and the aim is to have the rows revealed when the checkbox is checked and then hidden again if the checkbox is unchecked. The code I am using is below. Rather than unhiding and hiding the rows as I'd like, the code does nothing. When I switch the spots of the "1" and "0" as seen below, it will unhide the rows when the checkbox is checked, but it won't re-hide the cells when it is unchecked.

    Code that does nothing:
    Sub CheckBox47_Click()
        If CheckBox47 = 1 Then
            Rows("66:67").EntireRow.Hidden = False
        ElseIf CheckBox47 = 0 Then
            Rows("66:67").EntireRow.Hidden = True
        End If
    End Sub
    Code that unhides but does not re-hide rows:
    Sub CheckBox47_Click()
        If CheckBox47 = 0 Then
            Rows("66:67").EntireRow.Hidden = False
        ElseIf CheckBox47 = 1 Then
            Rows("66:67").EntireRow.Hidden = True
        End If
    End Sub
    What am I missing/doing wrong with the macro to get it to perform as I'd like?
    Last edited by Richard Buttrey; 09-29-2020 at 06:51 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Hide Unhide Rows using Checkbox
    By Huskersippi in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-28-2014, 05:08 PM
  2. [SOLVED] Macro to Automatically Hide/Unhide Rows Based on Checkbox
    By bga10s in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-27-2014, 07:32 PM
  3. Checkbox to hide and unhide rows
    By xjenniex in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-08-2014, 04:42 PM
  4. [SOLVED] Macro to hide/unhide rows using more than one checkbox
    By tsou in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-29-2013, 08:37 AM
  5. Hide rows macro not working properly
    By lgastal in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-09-2012, 11:43 PM
  6. Macro to hide/unhide rows using checkbox
    By jdp554 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-23-2011, 11:57 AM
  7. hide/unhide rows using checkbox
    By elfirahayu in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-20-2010, 03:31 PM

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