Current location - Health Preservation Learning Network - Slimming men and women - About excel Command Button (VBA)
About excel Command Button (VBA)
According to your meaning,

It shouldn't be on the list,

Instead, you should use the toolbar.

Toolbars can float on the window,

Does not change with the change of paper,

You can even delete the table.

Sub? My_Bar_Set()

Dim? My bar? As? Command bar

Dim? myBtm? As? CommandBarButton

Create a new "Bar 1" toolbar.

Settings? My bar? =? Command bar. Add("bar 1 ",msoBarFloating)

Settings? myBtm? =? command bars(" bar 1 ")controls . add(Type:= msoControlButton)。

Set the "Bar 1" toolbar.

With what? Apply. CommandBars("Bar 1 ")。 Control (1)

. OnAction? =? My _ Menu? My_menu is a sub, which is the program to be executed after clicking the button.

. Title? =? " asd "

. Height? =? 12

. Width? =? 5 1

. Visible? =? real

. Enable? =? real

End? along with

Set the position of "Bar 1" according to the resolution of the display.

Dim? h? As? long

Dim? v? As? long

h? =? 800? My monitor is set to 800*600. You can fill it out according to your determination.

v? =? 600

With what? Apply. CommandBars("Bar 1 ")

. Top? =? v? /? 2

. Left? =? h? -? 80

. Visible? =? real

End? along with

End? submarine

Sub? My Menu ()

ActiveCell。 Value? =? 1234? The program is set to run automatically when the workbook is opened. The original program is to call a window and then make a selection operation.

End? submarine