Automatically Hide/Unhide ROWS based on COLUMN Value

scottrperry

New Member
Joined
Nov 19, 2011
Messages
9
In Columns A and B I have created formulas that yield values I will use to hide Rows, such as "hide" and "autohide".
(I have a macro that hides all the rows where "hide" appears in Column B, works fine.)
I need a VBA to hide all Rows wherever Column A changes to "autohide", and unhide them when Column A changes to something other than "autohide".
I'd like to be able to reference named ranges instead of hard coding ranges in the VBA, but that's not a deal breaker.
Any help is appreciated.
(Excel/Office 365)
 
What type of buttons are you using ActiveX or form controls?
 
Upvote 0

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
currently I use Form Control whenever I need a button. (Mostly out of ignorance as to any advantage one has over the other.)

Ultimately, I'd like to have it "toggle" the state of the rows from hidden to visible, but just getting them to hide the way I want is my priority right now.
 
Upvote 0
In that case you assign your code to each button & use
VBA Code:
Set rCheck = Range(ActiveSheet.Shapes(Application.Caller).TopLeftCell.Value)
Just ensure that the top left corner of the button is in the cell with the range name.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,243
Members
449,075
Latest member
staticfluids

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