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

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
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,219
Messages
6,123,684
Members
449,116
Latest member
HypnoFant

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