Unhide Row Script

r0bism123

Board Regular
Joined
Feb 8, 2018
Messages
57
Hi gang,

I need some help. I want to unhide the below range without having the "Yes" criteria. So, when I press my Toggle Button, the action unhides all rows without criteria for all of the sheets in the workbook. I have been playing with the code and I can't figure it out. Your help is appreciated!

HTML:
Sub Unhide_All_Rows()
 Dim c As Range
 Dim ws As Worksheet
 Dim cR As Range

Set cR = Range("DF8:DF12,DF19:DF28,DF35:DF209,DF244:DF252,DF259,DF261")

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
 
For Each ws In ThisWorkbook.Worksheets
    With ws
        Set cR = .Range("DF8:DF12,DF19:DF28,DF35:DF209,DF244:DF252,DF259,DF261")
        For Each c In cR
            If c.Value = "Yes" Then c.EntireRow.Hidden = False
        Next c
    End With
Next ws
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic

End Sub
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
So on all sheets in your workbook what rows are you wanting to unhide

And do you ever want to hide them again?
 
Upvote 0
Good Morning,
so why are you not using your toggelButton_Click Event?

If MyToggelButton = true then
Hide rows
else
unhide rows
end if

something like that?

HTH
 
Upvote 0
So on all sheets in your workbook what rows are you wanting to unhide

And do you ever want to hide them again?


I want to unhide all of the rows in the range defined without having the "Yes" criteria. So, basically everything in the range without a criteria.
 
Last edited:
Upvote 0
Try this:
Code:
Sub Unhide_All_Rows()
 'Modified  3/20/2019  11:22:56 PM  EDT
 Dim c As Range
 Dim ws As Worksheet
 Dim cR As Range
Set cR = Range("DF8:DF12,DF19:DF28,DF35:DF209,DF244:DF252,DF259,DF261")
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
 
For Each ws In ThisWorkbook.Worksheets
    With ws
        Set cR = .Range("DF8:DF12,DF19:DF28,DF35:DF209,DF244:DF252,DF259,DF261")
        For Each c In cR
            c.EntireRow.Hidden = False
        Next c
    End With
Next ws
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
 
Upvote 0
You said:
when I press my Toggle Button

Not sure why your using a Toggle Button when you say your unfamiliar with a Toggle Button

 
Upvote 0
I suspect you did not write this script.
Or you would know how to do this.

Are you trying to Toggle the rows from hidden to unhidden.
 
Upvote 0
Try this:
Code:
Sub Unhide_All_Rows()
 'Modified  3/20/2019  11:22:56 PM  EDT
 Dim c As Range
 Dim ws As Worksheet
 Dim cR As Range
Set cR = Range("DF8:DF12,DF19:DF28,DF35:DF209,DF244:DF252,DF259,DF261")
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
 
For Each ws In ThisWorkbook.Worksheets
    With ws
        Set cR = .Range("DF8:DF12,DF19:DF28,DF35:DF209,DF244:DF252,DF259,DF261")
        For Each c In cR
            c.EntireRow.Hidden = False
        Next c
    End With
Next ws
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub

I tried that - no luck. It gives me:

runtime error '1004'

unable to set Hidden property of the Range class.
 
Upvote 0
I suspect you did not write this script.
Or you would know how to do this.

Are you trying to Toggle the rows from hidden to unhidden.

I didn't - I got some help here with it and it worked out well. I ran into an issue when I entered in a value on a hidden row that it would stay hidden. So, I want to simply unhide all of the rows within the worksheet. I made a toggle button on the worksheet and assigned the module to it so when it is clicked, it hides the rows based on the "Yes" value.
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,314
Members
452,634
Latest member
cpostell

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