Hide row if all cells in another range are blank

G

Guest

I would like to hide a row if all cells in another range are blank. Example:
If A4:A8 are all blank, then hide row A3.
 
G

Guest

This can easily be modified for any range and row:

Sub dford()
If Application.WorksheetFunction.CountA(Range("A4:A8")) > 0 Then
Else
Rows(3).EntireRow.Hidden = True
End If
End Sub
 
G

Guest

This works fine. But now I am trying to add it to an existig macro. It skips
over the code you suggested earlier. Below is the macro I am trying to use.

Sub HideRows()
'
' HideRows Macro
' Macro recorded 2/2/2007 by Doug
'

'
ActiveSheet.Unprotect
If Application.WorksheetFunction.CountA(Range("A39:A48")) > 0 Then
Else
Rows(38).EntireRow.Hidden = True
End If
Application.Goto Range("BM4"), True
Range("BP4:BP333").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="<>0", Operator:=xlAnd
Range("A1").Select
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub
 

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