Well, I found the code in the stackoverflow Forum.
I have triggered the code with Worksheet Change & it worked:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
ActiveSheet.Cells.Rows.Hidden = False 'unhide all
LastRow = Cells.Find(What:="*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row 'find the last row
For i = 1 To LastRow
If ActiveSheet.Cells(i, 1).Value2 = "" Or ActiveSheet.Cells(i, 1).Value2 = 0 Or IsError(ActiveSheet.Cells(i, 1).Value2) Then 'if it's an empty string, a 0 (empty cell) or an error
ActiveSheet.Cells(i, 1).EntireRow.Hidden = True 'then hide it
End If
Next i
Application.ScreenUpdating = True
UpBound = Cells.Rows.Count 'hides all rows after the last used one
Range(LastRow + 1 & ":" & UpBound).Rows.Hidden = True
End Sub
Thanks to excelforum.
Bookmarks