I am try to get a code to hide cell range or Columns but I can not get it to work in Office 365. and trying to tide it to a button
VBA Code:
Sub DoIfNotEmpty()
Dim ra As Range, re As Range
With ThisWorkbook.Worksheets("Sheet1")
Set ra = .Range("D4:F40")
For Each re In ra
If IsEmpty(re.Value) Or re.Value = vbNullString Then
Columns("D:F").EntireColumn.Hidden = True
End If
Next re
End With
End Sub
Private Sub CommandButton1_Click()
End Sub