View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
abcd[_2_] abcd[_2_] is offline
external usenet poster
 
Posts: 52
Default Activating/De-activating buttons

if the button objet vba's name is commandbutton1 on the Sheet1 object then:

Sheet1.CommandButton1.Enabled = false ' or true

the change event of this sheet may be used to detect a change on that sheet

example:

Private Sub Worksheet_Change(ByVal Target As Range)
If Not (Intersect(Target, Range("A1")) Is Nothing) Then
CommandButton1.Enabled = Not CommandButton1.Enabled
End If
End Sub