hiding blank rows

K

kijijijt

Hi,
looking for code that will search for data in column F,I,L and O from rows 2 through 138. If there is data in one or more cells in a specific row theni don't want to hide it but if all cells in a specific row are blank then i want to hide the row. Is this possible. thanks in advance.
 
A

Auric__

kijijijt said:
looking for code that will search for data in column F,I,L and O from
rows 2 through 138. If there is data in one or more cells in a specific
row then i don't want to hide it but if all cells in a specific row are
blank then i want to hide the row. Is this possible. thanks in advance.

Try this:

Sub hideBlanks()
Dim blank As Boolean
For L0 = 2 To 138
blank = ("" = Cells(L0, 6).Formula) And _
("" = Cells(L0, 9).Formula) And _
("" = Cells(L0, 12).Formula) And _
("" = Cells(L0, 15).Formula)
If blank Then Cells(L0, 1).EntireRow.Hidden = True
Next
End Sub

If there is a formula in those cells that sometimes returns a blank, change
all instances of ".Formula" to ".Value".

(There are other ways to do this, of course.)
 
K

kijijijt

kijijijt wrote:









Try this:



Sub hideBlanks()

Dim blank As Boolean

For L0 = 2 To 138

blank = ("" = Cells(L0, 6).Formula) And _

("" = Cells(L0, 9).Formula) And _

("" = Cells(L0, 12).Formula) And _

("" = Cells(L0, 15).Formula)

If blank Then Cells(L0, 1).EntireRow.Hidden = True

Next

End Sub



If there is a formula in those cells that sometimes returns a blank, change

all instances of ".Formula" to ".Value".



(There are other ways to do this, of course.)



--

Why can't you see the funny side?

Why aren't you laughing?

works great, thanks.
 
A

Auric__

wrote:
works great, thanks.

I swear to god, I'm going to hunt down whoever it is at Google who decided
that double-spacing EVERYTHING was a good idea! Argh!
 

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