Hi I have a worksheet that has multiple tables on it and a userform with command buttons to show/hide the tables. I added some rows to my cost sheet and updated the code to match the new parameters but now when I press the command button it doesn't hide the blank rows below the table, it just keeps going with blank rows. Here is the code, what am I missing? This was working prior to me adding rows to the sheet itself. I went from active sheet ending at AG174 to AG214.
'
'Show Cost Sheet
'
Private Sub CostCommandButton_Click()
'
' Turn off screen updating
'
Dim CostReportRge As Range
Set CostReportRge = ActiveSheet.Range("U93:AG214")
ActiveSheet.Unprotect Password:="XXX" ' Unprotect sheet to Select Range
Application.ScreenUpdating = False
'
' Unhide All Rows and Columns
'
CostReportRge.Select
If Selection.EntireColumn.Hidden = True Then 'if Hidden Then
Selection.EntireColumn.Hidden = False
End If
If Selection.EntireRow.Hidden = True Then 'if Hidden Then
Selection.EntireRow.Hidden = False
Else
ActiveSheet.Range("A134:A214").Select
Selection.EntireRow.Hidden = False
End If
'
' Hide Morning Report Columns
'
ActiveSheet.Range("A:U").Select
Selection.EntireColumn.Hidden = True
'
' Hide Morning Report Rows
'
ActiveSheet.Range("A1:A92").Select
Selection.EntireRow.Hidden = True
'
' Turn on screen updating
'
Application.ScreenUpdating = True
ActiveSheet.Range("AB100:AB100").Select
ActiveSheet.Protect Password:="XXX", DrawingObjects:=True, Scenarios:=True
End Sub
Bookmarks