Hi,

I have a VBA-code that I want to modify. The code hides all unused rows and it lets you select starting column and row. I have assigned the macro to a clickable box, so whenever I click the box the unused rows get hidden. However, I would like to make it so that the unused rows automatically get hidden without the need to button pressing, and get unhidden when a row no longer is empty. I would also like to add some rows to be ignored and thus always be shown.

Sub HideUnusedRows()
    Dim HiddenRow&, RowRange As Range, RowRangeValue&
    Const FirstRow As Long = 3
    Const LastRow As Long = 13
    Const FirstCol As String = "C"
    Const lastcol As String = "Z"
    ActiveWindow.DisplayZeros = False
    Application.ScreenUpdating = False
    For HiddenRow = FirstRow To LastRow
    Set RowRange = Range(FirstCol & HiddenRow & _
    ":" & lastcol & HiddenRow)
    RowRangeValue = Application.Sum(RowRange.Value)
    If RowRangeValue <> 0 Then
    Rows(HiddenRow).EntireRow.Hidden = False
    Else
    Rows(HiddenRow).EntireRow.Hidden = True
    End If
    Next HiddenRow
    Application.ScreenUpdating = True
End Sub