Hi everyone
I've written some code to hide certain rows based on the selection of a drop down box in a separate worksheet. The code relates to a cell named EntityE which is linked to the drop down box on the separate worksheet.
Here is the code I have:
When the macro runs I get a runtime error 1004 saying "Unable to set the hidden property of the range class"
Does anyone know why this isn't working? Thanks!!
I've written some code to hide certain rows based on the selection of a drop down box in a separate worksheet. The code relates to a cell named EntityE which is linked to the drop down box on the separate worksheet.
Here is the code I have:
Code:
Sub Worksheet_Calculate()
Call FreezeScreen(True)
If Range("EntityE").Value = "X1" Then
Sheets("Expenses").Activate
Range("WPFExpensesRows").Select
Selection.EntireRow.Hidden = True
End If
If Range("EntityE").Value = "X2" Then
Sheets("Expenses").Activate
Range("WPFExpensesRows").Select
Selection.EntireRow.Hidden = False
End If
If Range("EntityE").Value = "X3" Then
Sheets("Expenses").Activate
Range("WPFExpensesRows").Select
Selection.EntireRow.Hidden = False
End If
Range("B7").Activate
Sheets("Tax Account").Activate
Call FreezeScreen(False)
End Sub
When the macro runs I get a runtime error 1004 saying "Unable to set the hidden property of the range class"
Does anyone know why this isn't working? Thanks!!