The Command Buttons in VBA for Excel
|
613-749-4695 (Peter) |
Tips and Ideas on Excel |
Tips and Ideas on Macros |
VBA Chapter 24A of 24: The Command Buttons in VBA for Excel In the toolbox the command button has this icon . The command button is a very active control and there is always VBA code behind it. The command buttons are usually placed at the bottom of the form and serve to complete the transaction for which the form has been created. The caption of these buttons are usually "Go" , "Run" , "Submit" , "Cancel" , etc. Properties The other interesting properties of the command button are: - WordWrap to be able to write more that one line on a button, For advanced users there are the: Code Name your command button before developing your code. VBA uses the name of the command button when it creates lines of code related to events. So if you don't name your command button VBA will create the private sub:: A very simple VBA procedure for the command button would look like this: Private Sub cmbSubmit_Click() The content of the combo box "cbxInput" is entered in cell "F1" of the sheet "Code" and the form (frmPassport) is closed. |
Next Chapter: Programming Labels in VBA for Excel |
VBA Table of Contents |
Discover Even More in 50 Excel spreadsheets |
|
613-749-4695 (Peter) |
Tips and Ideas on Excel |
Tips and Ideas on Macros |
The Command Buttons in VBA for Excel