We’re rewarding the question askers & reputations are being recalculated! Read more.

 3 added 53 characters in body edited Nov 13 '18 at 7:06 200_success 138k2121 gold badges175175 silver badges448448 bronze badges Your test for hidden rows suggests you may already have hidden rows. Nested IF statements could reduce the number of tests to be done. As you are removing color from all cells, do it before the loop: 'Your test for hidden rows suggests you may already have hiddenSub rows.Color() 'Nested IF statements could reduce the number of testsDim tomyRange beAs done.Range 'As you are removing color from all cells, do it before the loop: Sub Color() Dim myRangecell As Range Dim cell As Range Application.ScreenUpdating = False Set myRange = ThisWorkbook.Sheets("Print version").Range("Print_Area") myRange.Interior.ColorIndex = 0 For Each cell In myRange if Not cell.EntireRow.Hidden then ' once hidden, no more cell values will be tested on the row If cell.HasFormula = True And cell.Value = "" then Rows(cell.Row).EntireRow.Hidden = True endif endif Next Application.ScreenUpdating = True End Sub  End Sub 'Your test for hidden rows suggests you may already have hidden rows. 'Nested IF statements could reduce the number of tests to be done. 'As you are removing color from all cells, do it before the loop: Sub Color() Dim myRange As Range Dim cell As Range Application.ScreenUpdating = False Set myRange = ThisWorkbook.Sheets("Print version").Range("Print_Area") myRange.Interior.ColorIndex = 0 For Each cell In myRange if Not cell.EntireRow.Hidden then ' once hidden, no more cell values will be tested on the row If cell.HasFormula = True And cell.Value = "" then Rows(cell.Row).EntireRow.Hidden = True endif endif Next Application.ScreenUpdating = True  End Sub Your test for hidden rows suggests you may already have hidden rows. Nested IF statements could reduce the number of tests to be done. As you are removing color from all cells, do it before the loop: Sub Color() Dim myRange As Range Dim cell As Range Application.ScreenUpdating = False Set myRange = ThisWorkbook.Sheets("Print version").Range("Print_Area") myRange.Interior.ColorIndex = 0 For Each cell In myRange if Not cell.EntireRow.Hidden then ' once hidden, no more cell values will be tested on the row If cell.HasFormula = True And cell.Value = "" then Rows(cell.Row).EntireRow.Hidden = True endif endif Next Application.ScreenUpdating = True End Sub  2 improved formatting edited Nov 13 '18 at 0:37 Dan M 122 bronze badges 'Your test for hidden rows suggests you may already have hidden rows. 'Nested IF statements could reduce the number of tests to be done. 'As you are removing color from all cells, do it before the loop: Sub Color() Dim myRange As Range Dim cell As Range Application.ScreenUpdating = False Set myRange = ThisWorkbook.Sheets("Print version").Range("Print_Area") myRange.Interior.ColorIndex = 0 For Each cell In myRange if Not cell.EntireRow.Hidden then ' once hidden, no more cell values will be tested on the row If cell.HasFormula = True And cell.Value = "" then Rows(cell.Row).EntireRow.Hidden = True endif endif Next Application.ScreenUpdating = True  'Your test for hidden rows suggests you may already have hidden rows. 'Nested IF statements could reduce the number of tests to be done. 'As you are removing color from all cells, do it before the loop: Sub Color() Dim myRange As Range Dim cell As Range Application.ScreenUpdating = False Set myRange = ThisWorkbook.Sheets("Print version").Range("Print_Area") myRange.Interior.ColorIndex = 0 For Each cell In myRange if Not cell.EntireRow.Hidden then ' once hidden, no more cell values will be tested on the row If cell.HasFormula = True And cell.Value = "" then Rows(cell.Row).EntireRow.Hidden = True endif endif Next Application.ScreenUpdating = True EndEnd Sub 'Your test for hidden rows suggests you may already have hidden rows. 'Nested IF statements could reduce the number of tests to be done. 'As you are removing color from all cells, do it before the loop: Sub Color() Dim myRange As Range Dim cell As Range Application.ScreenUpdating = False Set myRange = ThisWorkbook.Sheets("Print version").Range("Print_Area") myRange.Interior.ColorIndex = 0 For Each cell In myRange if Not cell.EntireRow.Hidden then ' once hidden, no more cell values will be tested on the row If cell.HasFormula = True And cell.Value = "" then Rows(cell.Row).EntireRow.Hidden = True endif endif Next Application.ScreenUpdating = True End Sub 'Your test for hidden rows suggests you may already have hidden rows. 'Nested IF statements could reduce the number of tests to be done. 'As you are removing color from all cells, do it before the loop: Sub Color() Dim myRange As Range Dim cell As Range Application.ScreenUpdating = False Set myRange = ThisWorkbook.Sheets("Print version").Range("Print_Area") myRange.Interior.ColorIndex = 0 For Each cell In myRange if Not cell.EntireRow.Hidden then ' once hidden, no more cell values will be tested on the row If cell.HasFormula = True And cell.Value = "" then Rows(cell.Row).EntireRow.Hidden = True endif endif Next Application.ScreenUpdating = True  End Sub 1 answered Nov 13 '18 at 0:20 Dan M 122 bronze badges 'Your test for hidden rows suggests you may already have hidden rows. 'Nested IF statements could reduce the number of tests to be done. 'As you are removing color from all cells, do it before the loop: Sub Color() Dim myRange As Range Dim cell As Range Application.ScreenUpdating = False Set myRange = ThisWorkbook.Sheets("Print version").Range("Print_Area") myRange.Interior.ColorIndex = 0 For Each cell In myRange if Not cell.EntireRow.Hidden then ' once hidden, no more cell values will be tested on the row If cell.HasFormula = True And cell.Value = "" then Rows(cell.Row).EntireRow.Hidden = True endif endif Next Application.ScreenUpdating = True End Sub