Hide Rows

M

Martin

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
 
B

Bob Phillips

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

Mike H

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top