Consulting

Results 1 to 20 of 30

Thread: Hide rows with option buttons

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Regular
    Joined
    Jan 2021
    Posts
    65
    Location

    Hide rows with option buttons

    I have a group of 3 option buttons and each option button relates to a group of few rows. In my code option buttons names are "Gumbmogućnosti".
    What Im trying to do is to hide rows depending on which option button is chosen. I would like Excel to automatically display (i.e. unhide) 3 rows and hide the other 9 rows (i.e. the other 2 sets of rows).
    I tried to find solution on internet but nothing works for me. This is one example what I tried but I got "error 424- Object required".
    Private Sub Gumbmogućnosti2_Klikni()
    If Gumbmogućnosti2.Value = True Then
    Rows("11:14").EntireRow.Hidden = False
    Rows("16:18").EntireRow.Hidden = True
    Rows("20:23").EntireRow.Hidden = True
    End If
    End Sub
    
    
    Private Sub Gumbmogućnosti3_Klikni()
    If Gumbmogućnosti3.Value = True Then
    Rows("11:14").EntireRow.Hidden = True
    Rows("16:18").EntireRow.Hidden = False
    Rows("20:23").EntireRow.Hidden = True
    End If
    End Sub
    
    
    Private Sub Gumbmogućnosti4_Klikni()
    If Gumbmogućnosti4.Value = True Then
    Rows("11:14").EntireRow.Hidden = True
    Rows("16:18").EntireRow.Hidden = True
    Rows("20:23").EntireRow.Hidden = False
    End If
    End Sub
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •