View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Lisa Lisa is offline
external usenet poster
 
Posts: 328
Default Runtime Error in code

Hi
Here's my code and it work initially, but now I get the following error
message:
"Runtime error 1004: Unable to set the hidden property of the range class."
Can anyone help as to why?

Private Sub HideEmptyCases_Click()
If Range("Z5") = "" Then Columns("Z:AB").Hidden = True
If Range("W5") = "" Then Columns("W:Y").Hidden = True
If Range("T5") = "" Then Columns("T:V").Hidden = True
If Range("Q5") = "" Then Columns("Q:S").Hidden = True
If Range("N5") = "" Then Columns("N:P").Hidden = True
If Range("K5") = "" Then Columns("K:M").Hidden = True
If Range("H5") = "" Then Columns("H:J").Hidden = True
If Range("E5") = "" Then Columns("E:G").Hidden = True
If Range("B5") = "" Then Columns("B:D").Hidden = True

End Sub

Thanks
Lisa