Macro to show a button?

S

Steach91

Is it possible to a worksheet that hides a command button, and then a
macro is called, and allow the macro to unhide a command button?

Example:
Macro is run:
If Cell A1 = 100 then borrower can see the command button
if Cell A1 <> 100 then borrower can't see the command button

Is this even possible using VBA?
 
B

Bearacade

Sure there is, try this:

If ActiveSheet.Shapes("CommandButton1").Visible = True Then
ActiveSheet.Shapes("CommandButton1").Visible = False
ElseIf ActiveSheet.Shapes("CommandButton1").Visible = False Then
ActiveSheet.Shapes("CommandButton1").Visible = True
End I
 
B

Brian G

Here are some ideas:
1) hide and unhide a row/column
2) this is just a thought, but userforms have the .show method, and I'm not
sure if that would apply to something like a command button offhand.
3) use a drawing object and change the color from gray to no color.
 
J

JLatham

You can simplify that even more to become a toggle switch by using this code

ActiveSheet.Shapes("CommandButton1").Visible =
Not(ActiveSheet.Shapes("CommandButton1").Visible)

it will flip flop back and forth between Visible/Not Visible (True/False)
each time it's called.
 
Top