Hide Buttons based on Result

rhombus4

Well-known Member
Joined
May 26, 2010
Messages
586
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I have 6 buttons which have an individual macro. Based on the result in Cell A1 I want it to only show the button/macro and hide the other 5 but not sure how to do. ~When I right click on a MAcro and click on Assign these are the names that they are currently called and assigned to.

'Book1.xls'!Belgium
'Book1.xls'!Italy
'Book1.xls'!England
'Book1.xls'!France
'Book1.xls'!Spain
 
No, it doesn't go in a General module like Module1. Right click the worksheet tab and choose View Code. Put the code in there.

Ok managed to get it to work by just typing the word in Cell A1. Must be it doesnt like the formula in cell A1 is it possible to copy whatever is in cell A1 and put the value somewhere else. and then refer the code to the other cell??? or change the formula.

Also I have a vlookup formula but if an answer isnt in the list how do I get it to say "incorrect" or something similar
 
Upvote 0

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
The Worksheet_Change event won't fire when the result of a formula changes. What is the formula? We need to find a precedent cell that is changed manually.
 
Upvote 0
If J20 has a formula what's that? As I said we need to find a precedent cell for A1 that's changed by the user. Otherwise you could use the Worksheet_Calculate event procedure, but that may fire too often.
 
Upvote 0
if j20 has a formula what's that? As i said we need to find a precedent cell for a1 that's changed by the user. Otherwise you could use the worksheet_calculate event procedure, but that may fire too often.

j20 =max(a20:h20)
 
Upvote 0
looks like it doesnt like any formula as even if I just try moving to a different cell. ie in D1 and enter =A1 then change the module to If Target.Address <> "$D$1" Then Exit Sub

Also its case sensitive, not only if I enter belgium instead of Belgium it wont work which I understand but also if I dont enter the

Target.Address <> "$D$1" Then Exit Sub with a capital D and use d it doesnt work as well, didnt know cell references were case sensitive
 
Upvote 0

Forum statistics

Threads
1,224,574
Messages
6,179,633
Members
452,933
Latest member
patv

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