返回列表 上一主題 發帖

如何控制指令按鈕次數??

如何控制指令按鈕次數??

指令按鈕名稱為 CommandButton1 要如何控制按鈕次數
ex:只能按1次就在不動作 或者 按3次就在不動作
重開excel 就重新由0開始計算
不知是否可行??

工作表模組
Private Sub CommandButton1_Click()
Static x
x = x + 1
'你要做的工作
If x = 3 Then CommandButton1.Enabled = 0
End Sub
---------------------------------------
This WorkBook模組
Private Sub Workbook_Open()
Sheet1.CommandButton1.Enabled = 1
End Sub

TOP

感謝版主賜教~

TOP

        靜思自在 : 手心向下是助人,手心向上是求人;助人快樂,求人痛苦。
返回列表 上一主題