View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
William Benson William Benson is offline
external usenet poster
 
Posts: 121
Default Activating/De-activating buttons

If you mean a macro button on a command bar, I do not know how to do that
because I think they are either visible (added to the command bar) or not. I
don't think they can be disabled.


Assuming the "macro button" is a command button on a worksheet, yes.

Private Sub Worksheet_Change(ByVal Target As Range)

'test this by changing the value in cell A1
Const strTestValue = 5 'For example only

If ActiveSheet.Range("A1") = AcceptValue Then
CommandButton1.Enabled = True
Else
CommandButton1.Enabled = False
End If

End Sub



"Nash" wrote in message
...
Is there a way to activate a macro button based on a value in a cell and
then
de-activating the button if the value does not match?

Thanks,