ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hide Rows (https://www.excelbanter.com/excel-programming/416468-hide-rows.html)

Martin

Hide Rows
 
Hi,

Here is my code:

Set myrange = Range("A18:A1220")
For Each c In myrange
If Value = Empty Then c.Row.Hidden = True
Next

What I am trying to do is check the value on cells A18 to A1220 and if they
are blank or empty then hide the entire row. However I get an error message
saying the object is required.

Can anyone point me in the right direction?

Many thanks,

Martin

Bob Phillips[_3_]

Hide Rows
 
Set myrange = Range("A18:A1220")
For Each c In myrange
If c.Value = "" Then c.Entirerow.Hidden = True
Next


--
__________________________________
HTH

Bob

"Martin" wrote in message
...
Hi,

Here is my code:

Set myrange = Range("A18:A1220")
For Each c In myrange
If Value = Empty Then c.Row.Hidden = True
Next

What I am trying to do is check the value on cells A18 to A1220 and if
they
are blank or empty then hide the entire row. However I get an error
message
saying the object is required.

Can anyone point me in the right direction?

Many thanks,

Martin




Mike H

Hide Rows
 
Martin,

Try

Sub sonic()
Set myrange = Range("A18:A1220")
For Each c In myrange
If IsEmpty(c) Then c.EntireRow.Hidden = True
Next
End Sub

Mike

"Martin" wrote:

Hi,

Here is my code:

Set myrange = Range("A18:A1220")
For Each c In myrange
If Value = Empty Then c.Row.Hidden = True
Next

What I am trying to do is check the value on cells A18 to A1220 and if they
are blank or empty then hide the entire row. However I get an error message
saying the object is required.

Can anyone point me in the right direction?

Many thanks,

Martin


Martin

Hide Rows
 
Thank you both for your help, it is much appreciated.

Martin

"Mike H" wrote:

Martin,

Try

Sub sonic()
Set myrange = Range("A18:A1220")
For Each c In myrange
If IsEmpty(c) Then c.EntireRow.Hidden = True
Next
End Sub

Mike

"Martin" wrote:

Hi,

Here is my code:

Set myrange = Range("A18:A1220")
For Each c In myrange
If Value = Empty Then c.Row.Hidden = True
Next

What I am trying to do is check the value on cells A18 to A1220 and if they
are blank or empty then hide the entire row. However I get an error message
saying the object is required.

Can anyone point me in the right direction?

Many thanks,

Martin



All times are GMT +1. The time now is 02:37 PM.

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