Hide Columns Depending on Result of a Cell

Excelor

New Member
Joined
Sep 5, 2014
Messages
18
Okay, I am new to a lot of this, so this may be simple.

I am looking for a formula or code that will hide columns depending on the content of a certain cell.

I found some code on an earlier post but that only worked when the cell was selected and manually changed.

What I have is a cell, say L1, that has a formula which based on the result of other cells will either return a "Y" or an "N". When this returns an "N" I want columns D:I to be hidden. When it is a "Y" the columns will be visible.

Hopefully that makes sense, hope someone can help!!

Thanks
 
Mike,

the change event given by Michael should only fire when you have "N" in L1, or if you change it.

I have Excel 2007 and is working for me. Did you have macros enabled on the other computer?

FarmerScott
 
Upvote 0

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Mike,

the change event given by Michael should only fire when you have "N" in L1, or if you change it.

I have Excel 2007 and is working for me. Did you have macros enabled on the other computer?

FarmerScott

Great, I mustn't have had them enabled. Told you I was new to it all!!

Whenever I click on any cell in the sheet it seems to run it. When I switch to that sheet it has not changed but then when I click a cell, it seems to activate it.

Either way, it works how I need it to so it is spot on.

Thanks again for all this, I knew it would be simple but I am literally just starting to try and learn about visual basic and macros, etc. A brand new language to me!

Thanks all
 
Upvote 0

Forum statistics

Threads
1,224,811
Messages
6,181,081
Members
453,021
Latest member
Justyna P

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