Excel 求助,动态改变按钮的执行命令

2025-05-10 00:59:11
推荐回答(1个)
回答1:

Sub 按钮1()

On Error Resume Next

With Sheets("结束")

.Select

.CommandButton2.Name = "CommandButton1"

.CommandButton3.Name = "CommandButton1"

End With

End Sub

Sub 按钮2()

On Error Resume Next

With Sheets("结束")

.Select

.CommandButton1.Name = "CommandButton2"

.CommandButton3.Name = "CommandButton2"

End With

End Sub

Sub 按钮3()

On Error Resume Next

With Sheets("结束")

.Select

.CommandButton1.Name = "CommandButton3"

.CommandButton2.Name = "CommandButton3"

End With

End Sub