|
|
|
|
Adding Controls to a SpreadsheetTo add a control to a spreadsheet, simply select a control in the Control Toolbar and create the tool in the spreadsheet, just like you would create a control on a form in the Visual basic editor. Once you create the control, right click on it and select the Properties option. This will bring up the Properties window. Once this window is open, it refreshes automatically each time you select a control. To edit the code associated with a control, simply double click on the control. The controls behave similarly to the controls in the regular VB compiler, but there are some differences. For example, when you create a combo box in the VB compiler, there is a "List" field in the Properties where you can type in the components of the list. In VBA for Excel, there is no "List" field but there is a "ListFillRange" field. To define the list, you need to enter the list items in some cells somewhere on the spreadsheet. Typically, you use one of the extra sheets in the background for this type of information. For example, if I have a sheet called "Extra" where I have defined the list items, I would type "Extra!C5:C7" in the ListFillRange field. |