Jul
Cell G will always contain a formula that references other parts of the Excel workbook.
The below VB script works only for the first iteration. What is a superior script?
Sub HideRows()
show0hide1 = 1 'put 0 to show, put 1 to hide
row2chk = “$2:$200″
For rw = Range(row2chk).Cells(1).Row To Range(row2chk).Cells(Range(row2chk).Cell…
If WorksheetFunction.CountA(Range(”G”)) = 0 And WorksheetFunction.CountA(Range(”G”)) <> 0 Then a = a 1
If WorksheetFunction.Sum(Range(”G”)) = 0 And WorksheetFunction.CountA(Range(”G”)) <> 0 And Not Range(”G”).Find(”0″, lookat:=xlValue) Is Nothing Then a = a 1
If a > 0 Then Range(”A” & rw).EntireRow.Hidden = show0hide1: a = 0
Next
End Sub
Answer:
Try the following
Sub HideRows()
On Error Resume Next
show0hide1 = 1 'put 0 to show, put 1 to hide
row2chk = “$2:$200″ 'row range to check if G on that row is blank
For rw = Range( row2chk).Cells( 1).Row To Range( row2chk).Cells( Range( row2chk).Cells.Count).Row
If Range( “A” & rw).Value <> “” And Range( “G” & rw).Value = 0 Then Range( “A” & rw).EntireRow.Hidden = show0hide1
Next
End Sub
Please contact for more details