Hidding buttons

S

Steve

Hello!

I have a button that i want to be hidden unless a certain cell has a
certain value.

Any ideas?

Thanks

Steve


---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 080114-1, 14/01/2008
Tested on: 14/01/2008 16:05:29
avast! - copyright (c) 1988-2008 ALWIL Software.
http://www.avast.com
 
D

Dave Peterson

Maybe you could use a worksheet_change event or worksheet_Calculate.

It would depend on how that cell changes (by formula or by typing) and what kind
of button it is. (Is it an optionbutton from the Forms toolbar or an
optionbutton from the control toolbox toolbar--or is it a button from the Forms
toolbar or a commandbutton from the control toolbox toolbar?)
 
S

Steve

Maybe you could use a worksheet_change event or worksheet_Calculate.

It would depend on how that cell changes (by formula or by typing) and
what kind of button it is. (Is it an optionbutton from the Forms
toolbar or an optionbutton from the control toolbox toolbar--or is it
a button from the Forms toolbar or a commandbutton from the control
toolbox toolbar?)

Hi, Yes its a commandbutton from the control toolbox tollbar. Also I
would like to know both (Formula and by typing) As I will be using both
at some point.

Thanks


---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 080114-2, 14/01/2008
Tested on: 14/01/2008 16:42:13
avast! - copyright (c) 1988-2008 ALWIL Software.
http://www.avast.com
 
D

Dave Peterson

Option Explicit
'based on a formula in B1
Private Sub Worksheet_Calculate()
Me.CommandButton1.Visible _
= Not (CBool(LCase(Me.Range("b1")) = LCase("hide")))
End Sub

'based on typing in A1
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Intersect(Target, Me.Range("a1")) Is Nothing Then Exit Sub

Me.CommandButton1.Visible _
= Not (CBool(LCase(Target.Value) = LCase("hide")))
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

VBA time and date? 1
Locking Cells 1
Spin button 2
How do you hide ..... 2
Auto insert 2
Transparent button 5
Dont want a button 2
autosaving - message box 3

Top