View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default Conditional Button.

One way:

Create a button (say, "Button 1") from the Forms toolbar and attach your
macro to it.

Does A1 have a formula in it? If so, put this in your worksheet code
module:

Private Sub Worksheet_Calculate()
With Range("A1")
If IsNumeric(.Value) Then _
Me.Shapes("Button 1").Visible = .Value 0
End With
End Sub

If instead A1 is a manual entry, use the Worksheet_Change() event
instead:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If Not Intersect(.Cells, Range("A1")) Is Nothing Then
If IsNumeric(.Cells(1).Value) Then _
Me.Shapes("Button 1").Visible = .Cells(1).Value 0
End If
End With
End Sub


In article ,
sungen99
wrote:

I have a list of data. If cell A <= 0 (zero) I want a button to appear
that will run a macro. Can anyone help me with this please?