Current location - Recipe Complete Network - Food world - EXCEL control, click a button to pop up a dialog box. How?
EXCEL control, click a button to pop up a dialog box. How?

after starting excel, press the shortcut key Alt+F11, and double-click sheet1→ on the left → double-click and enter the code on the right:

Sub test()

MsgBox "hello, fat cat"' to pop up the key sentences in the dialog box.

End Sub

Go back to excel and click Insert → Shape → Rectangle. After inserting, right-click Specify Macro, select test and confirm:

Click this rectangle to see a dialog box.