Excel 2010 Bible
Chapter 41: Creating UserForms 839 The following is an example of how you can use the InputBox function: CName = InputBox(“Custo ...
Part VI: Programming Excel with VBA 840 FIGURE 41.3 A simple message box, displayed with the VBA MsgBox function. To get a respo ...
Chapter 41: Creating UserForms 841 Constant Value Description vbRetryCancel 5 Displays Retry and Cancel buttons. vbCritical 16 D ...
Part VI: Programming Excel with VBA 842 The Sub procedure that follows is another example of using the MsgBox function: Sub GetA ...
Chapter 41: Creating UserForms 843 Activate the VB Editor and insert a new UserForm. Add the appropriate controls to the UserFo ...
Part VI: Programming Excel with VBA 844 When you move the mouse pointer over a control in the Toolbox, the control’s name appear ...
Chapter 41: Creating UserForms 845 To display the Properties window, choose View ➪ Properties Window (or press F4). The Properti ...
Part VI: Programming Excel with VBA 846 Handling events When you insert a UserForm, that form can also hold VBA Sub procedures t ...
Chapter 41: Creating UserForms 847 Creating the UserForm If you’re following along on your computer, start with a new workbook. ...
Part VI: Programming Excel with VBA 848 Use the Toolbox and add a CommandButton object to the UserForm, and use the Properties ...
Chapter 41: Creating UserForms 849 Creating an event-handler procedure An event-handler procedure is executed when an event occu ...
Part VI: Programming Excel with VBA 850 Another UserForm Example The example in this section is an enhanced version of the Chang ...
Chapter 41: Creating UserForms 851 Add an OptionButton control and then change the following properties. (This option is the de ...
Part VI: Programming Excel with VBA 852 Tip The VB Editor provides several useful commands to help you size and align the contro ...
Chapter 41: Creating UserForms 853 Creating event-handler procedures This section explains how to create two event-handler proce ...
Part VI: Programming Excel with VBA 854 End If Next cell End If ‘ Lower case If OptionLower Then For Each cell In Selection If N ...
Chapter 41: Creating UserForms 855 Try it with a few more selections. Notice that if you click Cancel, the UserForm is dismissed ...
Part VI: Programming Excel with VBA 856 Select the macro’s name and click Add to add the item to the list on the right. (Option ...
Chapter 41: Creating UserForms 857 you should make sure that the tab order is correct. Usually, it means that tabbing should mov ...
...
«
40
41
42
43
44
45
46
47
48
49
»
Free download pdf