Y
yoram
hi,
i have a few command buttons created directly on the spreadsheet
(not through userforms). i need to have the buttons appears and
disappear depending on a cell's value. ex. if the cell value = 1, have
the buttons become visible and invisible if any other value. visible
or enabled..either is fine.
the code i am using is this but i can't seem to get it to work. i am
using excel 2002. appreciate any help. thanks.
Private Sub Worksheet_Activate()
If Target.Address = "n40" and Target.Value = 1 Then
Worksheets("Sheet1").CommandButton("button1").Enabled = True
Else
Worksheets("Sheet1").CommandButton("button1").Enabled = False
End If
End Sub
i have a few command buttons created directly on the spreadsheet
(not through userforms). i need to have the buttons appears and
disappear depending on a cell's value. ex. if the cell value = 1, have
the buttons become visible and invisible if any other value. visible
or enabled..either is fine.
the code i am using is this but i can't seem to get it to work. i am
using excel 2002. appreciate any help. thanks.
Private Sub Worksheet_Activate()
If Target.Address = "n40" and Target.Value = 1 Then
Worksheets("Sheet1").CommandButton("button1").Enabled = True
Else
Worksheets("Sheet1").CommandButton("button1").Enabled = False
End If
End Sub