hiding blank rows

  • Thread starter Thread starter kijijijt
  • Start date Start date
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.
 
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.)
 
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.
 
Back
Top