Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try unprotecting the sheet
Activesheet.Unprotect "Lisa" wrote in message ... 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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Joe, that worked great!
Cheers Lisa "Joe" wrote: Try unprotecting the sheet Activesheet.Unprotect "Lisa" wrote in message ... 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
runtime error code 1004 | Excel Worksheet Functions | |||
VB Code + Runtime error 91 | Excel Programming | |||
VBA Code runtime error only after opening Locals window | Excel Programming | |||
RunTime Error 424 in a USERFORM's code | Excel Programming | |||
Repost with code - Runtime error '1004' | Excel Programming |