Forum Discussion
jmpjmp
Mar 14, 2023Copper Contributor
VBA Run-time error '1004' when Hide/Show Rows
Hello All, I am confronted with an error message - "Run-time error '1004': Unable to set the Hidden property of the Range class" when hiding/showing entire rows. Cells A1:A10 are given values...
- Mar 14, 2023
This is because the ListFillRange is set to A1:A10 and you are trying to hide those rows. An easy fix is to use On Error Resumen Next like below...
On Error Resume Next Rows(ShowRows).Hidden = False Rows(HideRows).Hidden = True On Error GoTo 0
Subodh_Tiwari_sktneer
Mar 14, 2023Silver Contributor
This is because the ListFillRange is set to A1:A10 and you are trying to hide those rows. An easy fix is to use On Error Resumen Next like below...
On Error Resume Next
Rows(ShowRows).Hidden = False
Rows(HideRows).Hidden = True
On Error GoTo 0
- jmpjmpMar 19, 2023Copper Contributor
Subodh_Tiwari_sktneer Thanks for explaining this. And your suggested solution worked well!
- Subodh_Tiwari_sktneerMar 22, 2023Silver Contributor
You're welcome jmpjmp!