Results 1 to 8 of 8

Thread: Hiding multiple non-contiguous rows simultaneously and quickly

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #8
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,954
    Location
    It is best to insert the SpeedUp Module and then call the routines.

    In a Module:
    Sub OBttnHide(sRows As String, Optional tfHide As Boolean = True)
        Dim a As Areas, v As Variant
    On Error GoTo EndSub
        SpeedOn
    Set a = Range(sRows).Rows.Areas
        For Each v In a
        v.EntireRow.Hidden = tfHide
        Next v
    EndSub:
        SpeedOff
    End Sub

    In the sheet code:
    Private Sub OptionButton1_Click()
      OBttnHide "2:3,5:5,9:10"
    End Sub
    
    Private Sub OptionButton2_Click()
      OBttnHide "2:3,5:5,9:10", False
    End Sub
    Last edited by Aussiebear; 04-27-2023 at 12:39 PM. Reason: Adjusted the code tags

Posting Permissions

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