Results 1 to 4 of 4

Button to show/Hide rows not working

Threaded View

  1. #1
    Registered User
    Join Date
    05-04-2015
    Location
    South Africa
    MS-Off Ver
    office for Mac
    Posts
    97

    Question Button to show/Hide rows not working

    Can Anyone please help me? I am struggling with the code for a button to show/hie specific rows:

    Sub ownershipQSE()
    If Cells(2, "I").Value = "Large Enterprise" Then
    Select Case Rows("160:194").Hidden
        Case Is = True
            Rows("160:178").Hidden = False
            Rows("5:151").Hidden = True
            Rows("180:194").Hidden = True
        Case Is = False
            Rows("160:194").Hidden = True
            Rows("5:151").Hidden = False
    End Select
    ElseIf Cells(2, "I").Value = "Qualifying Small Enterprise" Then
    Select Case Rows("160:194").Hidden
        Case Is = True
            Rows("160:178").Hidden = True
            Rows("5:151").Hidden = True
            Rows("180:194").Hidden = False
        Case Is = False
            Rows("160:194").Hidden = True
            Rows("5:151").Hidden = False
    End Select
    End If
    End Sub
    Let us assume Cell "I2" can be two different variables. The two variables is "Large enterprise" and "Qualifying Small Enterprise". When cell I2 is "large", then the code should hide rows 160:178, hide rows 5:151 but show 180:194. Therefore, when it is clicked again, it only shows rows 5:151, but hides rows 160:194. When cell I2 is "Qualifying Small Enterprise" then it needs to swap around when the button is clicked i.e. 180:194 is shown, and 160:178 is hidden, with the other features staying the same. The "Qualifying Small Enterprise" part does not want to work. It does not show row 5:151 when the button is clicked again after it has shows row 180:194. I have attached the sheet for your attention. can anyone please help, as I do not know what I am doing wrong.
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Show/Hide tabs on one button
    By lukestkd in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-22-2013, 02:14 PM
  2. VBA hide row based on pull down with button to toggle show/hide
    By myronr in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-12-2012, 06:07 PM
  3. Show/Hide Button
    By sdbrown81 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 02-17-2012, 09:19 AM
  4. Hide/Show Button
    By Kolin in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-14-2010, 07:00 PM
  5. command button on/off (show/hide)
    By gobbolino in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-13-2007, 10:35 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