ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to Specify Multiple Rows to Hide (https://www.excelbanter.com/excel-programming/353632-how-specify-multiple-rows-hide.html)

Paige

How to Specify Multiple Rows to Hide
 
Can someone help me with how to designate multiple sets of rows to hide? I
have the following code, but it errors out with 'Invalid use of property' or
'Unable to set the hidden property'; there is no protection set. I've used
the following variations and nothing works; I'm trying to get away from using
separate lines to designate rows 98:103, rows 116:121, and rows 180:185, and
instead group them together:

Thanks for any help!

Variation #1:
If Target.Address = "$C$16" Or Target.Address = "$C$14" Then
If Range("$C$16") = "x" Then
If Range("$C$14") = 12 Then
Rows("21:92").Hidden = False
Range("98:103,116:121,180:185").Hidden
End If
End If
End If

Variation #2:
If Target.Address = "$C$16" Or Target.Address = "$C$14" Then
If Range("$C$16") = "x" Then
If Range("$C$14") = 12 Then
Rows("21:92").Hidden = False
Range("98:103,116:121,180:185").Hidden = True
End If
End If
End If

Variation #3:
If Target.Address = "$C$16" Or Target.Address = "$C$14" Then
If Range("$C$16") = "x" Then
If Range("$C$14") = 12 Then
Range("21:92").Hidden
Range("98:103,116:121,180:185").Hidden
End If
End If
End If

Variation #4:
If Target.Address = "$C$16" Or Target.Address = "$C$14" Then
If Range("$C$16") = "x" Then
If Range("$C$14") = 12 Then
Range("21:92").Hidden = False
Range("98:103,116:121,180:185").Hidden = True
End If
End If
End If

Peter T

How to Specify Multiple Rows to Hide
 
Range("98:103,116:121,180:185").EntireRow.Hidden = True

Regards,
Peter T

"Paige" wrote in message
...
Can someone help me with how to designate multiple sets of rows to hide?

I
have the following code, but it errors out with 'Invalid use of property'

or
'Unable to set the hidden property'; there is no protection set. I've

used
the following variations and nothing works; I'm trying to get away from

using
separate lines to designate rows 98:103, rows 116:121, and rows 180:185,

and
instead group them together:

Thanks for any help!

Variation #1:
If Target.Address = "$C$16" Or Target.Address = "$C$14" Then
If Range("$C$16") = "x" Then
If Range("$C$14") = 12 Then
Rows("21:92").Hidden = False
Range("98:103,116:121,180:185").Hidden
End If
End If
End If

Variation #2:
If Target.Address = "$C$16" Or Target.Address = "$C$14" Then
If Range("$C$16") = "x" Then
If Range("$C$14") = 12 Then
Rows("21:92").Hidden = False
Range("98:103,116:121,180:185").Hidden = True
End If
End If
End If

Variation #3:
If Target.Address = "$C$16" Or Target.Address = "$C$14" Then
If Range("$C$16") = "x" Then
If Range("$C$14") = 12 Then
Range("21:92").Hidden
Range("98:103,116:121,180:185").Hidden
End If
End If
End If

Variation #4:
If Target.Address = "$C$16" Or Target.Address = "$C$14" Then
If Range("$C$16") = "x" Then
If Range("$C$14") = 12 Then
Range("21:92").Hidden = False
Range("98:103,116:121,180:185").Hidden = True
End If
End If
End If




Paige

How to Specify Multiple Rows to Hide
 
Thanks, Peter. I had read some reference material about 'entire row', but
obviously didn't understand its use with 'range' and rows. Again, thanks!!

"Peter T" wrote:

Range("98:103,116:121,180:185").EntireRow.Hidden = True

Regards,
Peter T

"Paige" wrote in message
...
Can someone help me with how to designate multiple sets of rows to hide?

I
have the following code, but it errors out with 'Invalid use of property'

or
'Unable to set the hidden property'; there is no protection set. I've

used
the following variations and nothing works; I'm trying to get away from

using
separate lines to designate rows 98:103, rows 116:121, and rows 180:185,

and
instead group them together:

Thanks for any help!

Variation #1:
If Target.Address = "$C$16" Or Target.Address = "$C$14" Then
If Range("$C$16") = "x" Then
If Range("$C$14") = 12 Then
Rows("21:92").Hidden = False
Range("98:103,116:121,180:185").Hidden
End If
End If
End If

Variation #2:
If Target.Address = "$C$16" Or Target.Address = "$C$14" Then
If Range("$C$16") = "x" Then
If Range("$C$14") = 12 Then
Rows("21:92").Hidden = False
Range("98:103,116:121,180:185").Hidden = True
End If
End If
End If

Variation #3:
If Target.Address = "$C$16" Or Target.Address = "$C$14" Then
If Range("$C$16") = "x" Then
If Range("$C$14") = 12 Then
Range("21:92").Hidden
Range("98:103,116:121,180:185").Hidden
End If
End If
End If

Variation #4:
If Target.Address = "$C$16" Or Target.Address = "$C$14" Then
If Range("$C$16") = "x" Then
If Range("$C$14") = 12 Then
Range("21:92").Hidden = False
Range("98:103,116:121,180:185").Hidden = True
End If
End If
End If






All times are GMT +1. The time now is 05:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com