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
 

Some videos you may like

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
16,829
Office Version
  1. 2013
Platform
  1. Windows
So on all sheets in your workbook what rows are you wanting to unhide

And do you ever want to hide them again?
 

silentwolf

Well-known Member
Joined
May 14, 2008
Messages
1,123
Office Version
  1. 2016
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
 

r0bism123

Board Regular
Joined
Feb 8, 2018
Messages
57
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:

r0bism123

Board Regular
Joined
Feb 8, 2018
Messages
57

ADVERTISEMENT

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

I am unfamiliar with the toggelButton_Click Event.
 

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
16,829
Office Version
  1. 2013
Platform
  1. Windows
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
 

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
16,829
Office Version
  1. 2013
Platform
  1. Windows

ADVERTISEMENT

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

 

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
16,829
Office Version
  1. 2013
Platform
  1. Windows
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.
 

r0bism123

Board Regular
Joined
Feb 8, 2018
Messages
57
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.
 

r0bism123

Board Regular
Joined
Feb 8, 2018
Messages
57
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.
 

Watch MrExcel Video

Forum statistics

Threads
1,109,000
Messages
5,526,172
Members
409,685
Latest member
Bellybb

This Week's Hot Topics

Top