Page 32 - Excel 2007 Bible
P. 32
02_044039 ftoc.qxp 11/21/06 10:53 AM Page xxxi
Contents
Chapter 42: Using UserForm Controls in a Worksheet. . . . . . . . . . . . 733
Why Use Controls on a Worksheet? ..........................................................................................733
Using Controls ..........................................................................................................................735
Adding a control ............................................................................................................735
About design mode ........................................................................................................736
Adjusting properties........................................................................................................736
Common properties........................................................................................................737
Linking controls to cells..................................................................................................738
Creating macros for controls ..........................................................................................738
Reviewing the Available ActiveX Controls..................................................................................739
CheckBox control ..........................................................................................................739
ComboBox control..........................................................................................................740
CommandButton control ................................................................................................740
Image control..................................................................................................................741
Label control ..................................................................................................................741
ListBox control................................................................................................................741
OptionButton control......................................................................................................741
ScrollBar control ............................................................................................................742
SpinButton control..........................................................................................................743
TextBox controls ............................................................................................................743
ToggleButton control ......................................................................................................744
Chapter 43: Working with Excel Events . . . . . . . . . . . . . . . . . . . . 745
Understanding Events ..............................................................................................................745
Entering event-handler VBA code ..................................................................................745
Using Workbook-Level Events ..................................................................................................747
Using the Open event ....................................................................................................748
Using the SheetActivate event ........................................................................................749
Using the NewSheet event ..............................................................................................749
Using the BeforeSave event ............................................................................................750
Using the BeforeClose event............................................................................................750
Working with Worksheet Events ..............................................................................................750
Using the Change event ..................................................................................................751
Monitoring a specific range for changes ..........................................................................752
Using the SelectionChange event ....................................................................................752
Using the BeforeRightClick event....................................................................................753
Using Non-Object Events..........................................................................................................754
Using the OnTime event ................................................................................................754
Using the OnKey event ..................................................................................................754
Chapter 44: VBA Examples . . . . . . . . . . . . . . . . . . . . . . . . . . 757
Working with Ranges ................................................................................................................757
Copying a range..............................................................................................................758
Copying a variable-size range..........................................................................................758
Selecting to the end of a row or column..........................................................................759
Selecting a row or column ..............................................................................................760
Moving a range ..............................................................................................................760
xxxi