• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Toggle button to hide/unhide rows based on cell value

AMIGD

New Member
I would like a button on my worksheet that when clicked will hide/unhide all rows where column 13 contains the text "COMPLETE"

I've been googling this for hours now and have found some solutions, but none that seem to toggle correctly, many of them work once but then don't work the second time, or you have to have two separate buttons

Can anybody help?
 
AMIGD
when clicked will hide/unhide all rows where column 13 contains the text "COMPLETE"
Means
... it should hide those "COMPLETE"-text rows and at once unhide those rows.
You would upload a sample Excel-file with a sample data with clear example - what?

... have You tried to use Filter, that no need any code?
 
AMIGD
when clicked will hide/unhide all rows where column 13 contains the text "COMPLETE"
Means
... it should hide those "COMPLETE"-text rows and at once unhide those rows.
You would upload a sample Excel-file with a sample data with clear example - what?

... have You tried to use Filter, that no need any code?
I am currently using filters for this but would like a button for extra speed and convenience.

I mean that on the first click of the button, it will hide all rows saying "COMPLETE"... If you click it a second time it will unhide all rows saying "COMPLETE" - So it is like an on/off switch for "COMPLETE".

I have attached some example data. So for this example I would want to click the button and rows 3, 5 and 7 would be hidden. Then when I click the button again rows 3,5,7 would be unhidden.
 

Attachments

  • Book1.xlsx
    12.1 KB · Views: 9
Last edited:
AMIGD
One sample based You original thread.
... which seems to be different than Your latest.
 

Attachments

  • K.xlsb
    16.2 KB · Views: 12
According to post #3 attachment a VBA demonstration as a beginner starter​
to paste to the Sheet1 worksheet module and working only when launched via a button :​
Code:
Sub Demo1()
        V = Application.Caller:  If IsError(V) Then Beep: Exit Sub
    With Me.Shapes(V).TextFrame.Characters
        Select Case Left(.Text, 4)
               Case "Hide"
                    [A1].AutoFilter 4, "<>COMPLETE"
                    .Text = "Show all"
               Case "Show"
                    [A1].AutoFilter 4
                    .Text = "Hide COMPLETE"
        End Select
    End With
End Sub
Do you like it ? So thanks to click on bottom right Like !​
 
Back
Top