ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Hide row if all cells in another range are blank (https://www.excelbanter.com/excel-discussion-misc-queries/129081-hide-row-if-all-cells-another-range-blank.html)

dford

Hide row if all cells in another range are blank
 
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.

Gary''s Student

Hide row if all cells in another range are blank
 
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

--
Gary''s Student
gsnu200703


"dford" wrote:

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.


dford

Hide row if all cells in another range are blank
 
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:A4 8")) 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

"Gary''s Student" wrote:

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

--
Gary''s Student
gsnu200703


"dford" wrote:

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.



All times are GMT +1. The time now is 05:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com