Private Sub Workbook_SheetDeactivate(ByVal Sh As Object)
Dim retval As Integer
Dim col As Range, rw As Range
For Each col In Sh.UsedRange.Columns
'Check Columns
If col.Hidden Then
msg = "There are hidden columns in the worksheet (" & Sh.Name & "). Unhide?"
retval = MsgBox(msg, vbYesNo, "Warning")
If retval = vbYes Then 'They OKd it
Application.EnableEvents = False
Sh.UsedRange.Columns.Hidden = False
Sh.UsedRange.Rows.Hidden = False
Application.EnableEvents = True
Else 'They didnt OK it
'Do nothing
End If
Else
'Check Rows
For Each rw In Sh.UsedRange.Rows
If rw.Hidden Then
msg = "There are hidden rows in the worksheet (" & Sh.Name & "). Unhide?"
retval = MsgBox(msg, vbYesNo, "Warning")
If retval = vbYes Then 'They OKd it
Application.EnableEvents = False
Sh.UsedRange.Rows.Hidden = False
Application.EnableEvents = True
Else 'They didnt OK it
'Do nothing
End If
End If
Next
End If
Next
End Sub