Row Hide

psamu

Active Member
Joined
Jan 3, 2007
Messages
462
If I want to hide row a15 when cell value in k5=1 and also if cell value in k5=2 then hide row A16. Please help me with the vba code.

Thanks.
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
You will need to put
Code:
ActiveSheet.unprotect "password"
at the beginning of your code
AND
Code:
ActiveSheet.protect "password"

at the end of your code.

Change the "password" to suit

Regards
Michael M
 
Upvote 0
Thanks again. It is working even with the protected worksheet, but when K5 cell changes with a formula, then it is not working. ( ie, I have a formula in K5 is =K10) Please help on this. Thanks.
 
Upvote 0
Take out that code, try this instead:

Code:
Private Sub Worksheet_Calculate()
ActiveSheet.Unprotect "password"
Application.ScreenUpdating = False
    Rows(15).Hidden = Range("K5") = 1
    Rows(19).Hidden = Range("K5") = 1
    Rows(16).Hidden = Range("K6") = 2
    Rows(20).Hidden = Range("K6") = 2
Application.ScreenUpdating = True
ActiveSheet.Protect "password"
End Sub
 
Upvote 0
Combo box Properties Linked to Cell K5
When combo box droped down list changes make cell K5 to 2 or 1 , then code does not work properly. It started to flicker and give error. Please help. Thanks.
 
Upvote 0
Sorry, I was thinking to do that way, but I have to change the scenario to this way. Thanks
 
Upvote 0

Forum statistics

Threads
1,222,830
Messages
6,168,507
Members
452,194
Latest member
Lowie27

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