Run-time error 1004: unable to set the hidden property of the range class

KMH

New Member
Joined
Nov 10, 2022
Messages
23
Office Version
  1. 2013
Platform
  1. Windows
Hi,

I have 5 rows (rows 58:63) that are to be hidden or unhidden depending on the value (Y/N) of another cell (I36).

What code do I use to allow it to continue to hide and unhide those rows depending on the value of cell I36?
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
If I36="N" then hide rows 58:63.
If I36="Y" then unhide rows 58:63

Please see code used below:

Dim iCell As Range: Set iCell = Intersect(Range("I36"), Target)
If iCell Is Nothing Then Exit Sub

Select Case iCell.Value
Case "N"
Rows("52:56").Hidden = False
Rows("58:63").Hidden = True
Case "Y"
Rows("52:56").Hidden = False
Rows("58:63").Hidden = False
'Case Else ' do nothing

End Select
 
Upvote 0

Forum statistics

Threads
1,215,030
Messages
6,122,762
Members
449,095
Latest member
m_smith_solihull

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top