Runtime Error in code

L

Lisa

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top