We’re rewarding the question askers & reputations are being recalculated! Read more.
3 added 53 characters in body
source | link

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
source | link
'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
source | link

'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