Hiding rows

T

trickdos

I am trying to hide rows based on a value of a sum formula. If the su
fo the row is 0, i want to hide that row. I think this should work
but it is imbedded under other for...next statements. I dont know i
this is a problem, but I get a Next without For error.

Thanks for your help in advance....


For a = 1 To 14
Range("hide").Value = a
Range("hidestart").Offset(a - 1, 0).Select
If cell.Value = 0 Then
Selection.EntireRow.Hidden = True

Next
 
T

trickdos

Thanks Frank, I caught that, but I am getting an error on the row: I
cell.Value = 0 Then

The error is: Object Required.

any ideas? Thanks again...
 
T

Tom Ogilvy

Why not use the Autofilter under the data menu.

as Frank Said

For a = 1 To 14
Range("hide").Value = a
Range("hidestart").Offset(a - 1, 0).Select
If cell.Value = 0 Then
Selection.EntireRow.Hidden = True
End If
Next a

Cell is undefined, so I believe you mean activeCell

For a = 1 To 14
Range("hide").Value = a
Range("hidestart").Offset(a - 1, 0).Select
If Activecell.Value = 0 Then
Selection.EntireRow.Hidden = True
End If
Next a
 
G

George Nicholson

In your code, the compiler doesn't know what "cell" is.

Dim rng as Range

For a = 1 To 14
Range("hide").Value = a
Set rng = Range("hidestart").Offset(a - 1, 0)
If rng.Value = 0 Then
rng.EntireRow.Hidden = True
End If
Next a
 

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