Well, if you insist
.
Option Explicit
Public Sub HideCells()
Dim sh As Worksheet
Dim i As Long
Dim j As Long
Dim CountRange As Range
' initialize variables
Application.ScreenUpdating = False
Set sh = Sheets("cooler outilne")
'Unhide all rows and columns
sh.Cells.EntireRow.Hidden = False
sh.Cells.EntireColumn.Hidden = False
' Hide rows with no data
For i = 5 To 141
Set CountRange = sh.Range(sh.Cells(i, "B"), sh.Cells(i, "BU"))
If Count_Range(CountRange) = False Then
CountRange.EntireRow.Hidden = True
End If
Next
For j = 2 To 73
Set CountRange = sh.Range(sh.Cells(5, j), sh.Cells(141, j))
If Count_Range(CountRange) = False Then
CountRange.EntireColumn.Hidden = True
End If
Next
Application.ScreenUpdating = True
End Sub
Public Function Count_Range(MyRange As Range) As Boolean
Dim bRtn As Boolean
Dim cl As Range
bRtn = False
For Each cl In MyRange
If Len(cl.Value) > 0 Then
bRtn = True
Exit For
End If
Next
Count_Range = bRtn
End Function
Bookmarks