I have the following code. It is failing on the hilited line. I am getting a Run-time error '1004', Unable to set Hidden property of the Range class. I checked and the range name does exist. The HideMonths and HideYr5 variables are both equal to True. If I comment out the line, everything finishes processing ok.

Sheets("Other_Input").Select
Range("OthMonthlyYr1").EntireColumn.Hidden = HideMonths
Range("OthMonthlyYr2").EntireColumn.Hidden = HideMonths Or HideYr2
Range("OthMonthlyYr3").EntireColumn.Hidden = HideMonths Or HideYr3
Range("OthMonthlyYr4").EntireColumn.Hidden = HideMonths Or HideYr4
Range("OthMonthlyYr5").EntireColumn.Hidden = HideMonths Or HideYr5


I even tried Worksheets("Other_Input").Range("OthMonthlyYr5").EntireColumn.Hidden = HideMonths Or HideYr5, but that didn't work either.

Can anyone help me?