Hide Row if "H" found

The Animal

Active Member
Joined
May 26, 2011
Messages
449
Hi.
I would like to create a toggle button that hides all rows if the letter "H" in found in the "A" column.

Any help with a formula that I can attach to a text box button would be great.

Thanks Stephen
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Put the following code in your ToggleButton. I guess it's a togglebutton ActiveX

Code:
Private Sub ToggleButton1_Click()
    
    Application.ScreenUpdating = False
    Cells.EntireRow.Hidden = False
    
    For i = 2 To Range("A" & Rows.Count).End(xlUp).Row
        If Cells(i, "A").Value = "H" Then
            Rows(i).EntireRow.Hidden = ActiveSheet.ToggleButton1
        End If
    Next
    
End Sub
 
Upvote 0
I do not understand, do you want the code for the togglebutton?
What do you want the textbox for?
 
Upvote 0
Hi.

I normally use a text box and just assign the formula to that text box that way I have control of all properties of the box. For example below may be applied to a text box to hide/unhide rows.

Sub ToggleCurrentMYOB()
ActiveSheet.Unprotect
Range("BF:BO").Columns.Hidden = Not Range("BF:BO").Columns.Hidden
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True, AllowInsertingColumns:=True, AllowInsertingRows _
:=True, AllowFiltering:=True
End Sub

So was enquiring what formula would look like if I was doing above.
 
Upvote 0
text box? or commandbutton?

Could you upload an image of your sheet to the cloud for what you have and what do you call textbox?
 
Upvote 0
Hi

Cannot upload ATM

But yes Insert>Text Box, draw the Text Box and then assign or create the macro to the text box.

I just need a macro that hides and unhides the full rows if "H" is found in A4:A1500

Thanks
 
Upvote 0
Like this:

Code:
Private Sub TextBox1_GotFocus()
    Application.ScreenUpdating = False
    For i = 2 To Range("A" & Rows.Count).End(xlUp).Row
        If Cells(i, "A").Value = "H" Then
            Rows(i).EntireRow.Hidden = Not Rows(i).EntireRow.Hidden
        End If
    Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,614
Messages
6,120,533
Members
448,969
Latest member
mirek8991

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top