How to remove all buttons or command buttons in excel?

      335
Excel for peaceworld.com.vn 365 Excel for peaceworld.com.vn 365 for Mac Excel 2021 Excel 2021 for Mac Excel 2019 Excel 2019 for Mac Excel năm nhâm thìn Excel năm nhâm thìn for Mac Excel 2013 Excel 2010 Excel 2007 More...Less

You can use a Form control button or a command button (an ActiveX control) lớn run a macro that performs an action when a user clicks it. Both these buttons are also known as a push button, which can be mix up khổng lồ automate the printing of a worksheet, filtering data, or calculating numbers. In general, a Form control button & an ActiveX control commvà button are similar in appearance and function. However, they vì chưng have sầu a few differences, which are explained in the following sections.

Bạn đang xem: How to remove all buttons or command buttons in excel?

Button (Form control)

*

Comm& button (ActiveX control)

*

In the sections below, learn how to add a macro to lớn a button in Excel—for Windows or the Mac.


Note: ActiveX controls are not peaceworld.com.vned on the Mac.


WindowsmacOS

Macros & VBA tools can be found on the Developer tab, which is hidden by mặc định.

The first step is to enable it. For more information, see the article: Show the Developer tab.

*

Add a button (Form control)

On the Developer tab, in the Controls group, clichồng Insert, and then under Form Controls, click Button .

Clichồng the worksheet location where you want the upper-left corner of the button to appear. The Assign Macro popup window appears.

Assign a macro khổng lồ the button, and then clichồng OK.

To specify the control properties of the button, right-cliông chồng the button, và then cliông chồng Format Control.

Add a commvà button (ActiveX control)

On the Developer tab, in the Controls group, cliông xã Insert, và then under ActiveX Controls, cliông xã Commvà Button .

Click the worksheet location at which you want the upper-left corner of the command button to lớn appear.

In the Controls group, clichồng View Code. This launches the Visual Basic Editor. Ensure that Click is chose in the drop-down menu on the right. The sub procedure CommandButton1_Click (see the figure below) runs these two macros when the button is clicked: SelectC15 & HelloMessage.

*

In the subprocedure for the comm& button, vày either of the following:

Enter the name of an existing macro in the workbook. You can find macros by clicking Macros in the Code group. You can run multiple macros from a button by entering the macro names on separate lines inside the subprocedure.

As necessary, add your own VBA code.

Cthua kém the Visual Basic Editor, & clichồng Design Mode to ensure design mode is off.

To run the VBA code that is now part of the button, click the ActiveX comm& button that you just created.

To edit the ActiveX control, make sure that you are in thiết kế mode. On the Developer tab, in the Controls group, turn on Design Mode.

To specify the control properties of the commvà button, on the Developer tab, in the Controls group, cliông chồng Properties

*
. You can also right-clichồng the comm& button, và then cliông chồng Properties.


Note: Before you cliông xã Properties, make sure that the object for which you want to lớn examine or change properties is already selected.


The Properties box appears. For detailed information about each property, select the property, & then press F1 to lớn display a Visual Basic Help topic. You can also type the property name in the Visual Basic Help Search box. The following table summarizes the properties that are available.

If you want to lớn specify

Use this property

General:

Whether the control is loaded when the workbook is opened. (Ignored for ActiveX controls.)

AutoLoad (Excel)

Whether the control can receive focus and respond lớn user-generated events.

Enabled (Form)

Whether the control can be edited.

Locked (Form)

The name of the control.

Name (Form)

The way the control is attached lớn the cells below it (không lấy phí floating, move sầu but bởi not form size, or move sầu và size).

Placement (Excel)

Whether the control can be printed.

PrintObject (Excel)

Whether the control is visible or hidden.

Visible (Form)

Text:

Font attributes (bold, italic, kích cỡ, strikethrough, underline, & weight).

Bold, Italic, Size, StrikeThrough, Underline, Weight (Form)

Descriptive text on the control that identifies or describes it.

Caption (Form)

Whether the contents of the control automatically wrap at the over of a line.

Xem thêm: Top 12 Phần Mềm, Web Chuyển Mp4 Sang Mp3 Online, Miễn Phí, Dễ Sử Dụng

WordWrap (Form)

Size & Position:

Whether the size of the control automatically adjusts khổng lồ display all the contents.

AutoSize (Form)

The height or width in points.

Height, Width (Form)

The distance between the control và the left or top edge of the worksheet.

Left, Top (Form)

Formatting:

The background color.

BackColor (Form)

The background style (transparent or opaque).

BackStyle (Form)

The foreground color.

ForeColor (Form)

Whether the control has a shadow.

Shadow (Excel)

Image:

The bitmaps khổng lồ display in the control.

Picture (Form)

The location of the picture relative khổng lồ its caption (left, top, right, & so on).

PicturePosition (Form)

Keyboard and Mouse:

The shortcut key for the control.

Accelerator (Form)

A custom mouse ibé.

MouseIcon (Form)

The type of pointer that is displayed when the user positions the mouse over a particular object (standard, arrow, I-beam, and so on).

MousePointer (Form)

Whether the control takes the focus when clicked.

TakeFocusOnClick (Form)


Macros & VBA tools can be found on the Developer tab, which is hidden by default, so the first step is to enable it

Go to Excel > Preferences… > Ribbon & Toolbar.

In the Customize the Ribbon category, in the Main Tabs danh sách, select the Developer kiểm tra box, and then cliông xã Save.

*

Add a button (Form control)

Follow these steps:

On the Developer tab, cliông chồng Button .

Cliông xã the worksheet location where you want the upper-left corner of the button lớn appear. The Assign Macro popup window appears.


Assign a macro khổng lồ the button and clichồng OK.

To specify the control properties of the button, right-click it, & then select Format Control.... 

Add a commvà button (Visual Basic control)

On the Developer tab, cliông chồng Button .

Clichồng the worksheet location where you want the upper-left corner of the comm& button lớn appear.


In the Assign Macro dialog box, select New, which will open the Visual Basic Editor (VBE) to lớn a pane with the following code:

Sub ButtonX_Click() End Sub In the subprocedure for the command button, between the Sub and End Sub lines, bởi either of the following:

Enter the name of an existing macro in the workbook. You can run multiple macros from a button by typing the macro names on separate lines inside the sub procedure

Add your own VBA code.

Cliông xã Design Mode to lớn ensure that design mode is off, then cthất bại the Visual Basic Editor window.

To edit the button, right-cliông xã it & choose Visual Basic.

To specify the control properties of the button, right-clichồng it, and then select Format Control....


Need more help?

You can always ask an expert in the Excel Tech Community or get tư vấn in the Answers community.