Introduction to Using VBA
(Visual Basic for Applications)
in Excel

> Instructions for three activities using VBA (Word document).

> 1) Insert a label and then have the computer make a sound when you click on the label

> 2) Insert a slider (scroll bar) and have VBA 'select' a cell based on the slider value

> 3) Insert a scroll bar and a label. The VBA code you will write will contain a loop which will write 10 numbers in the cells of a given row, starting with the scroll bar value, and increasing by 5 each time

> First activity

> - Bring up Control Toolbox and get into 'Design Mode'
> - Create the label and give it a new caption
> - Right-click and in the pop-up window select View Code
> - In the code shell inside the VBA editor, type Beep
> - Get back to Excel, exit Design mode, and click on the label to hear the beep.
> Second activity
> - Insert a scroll bar and a line of VBA code which 'selects' a given cell
> - The point is to dissect this line of code to give an idea how things work in VBA
> Third activity
> - Insert a scroll bar and a label, and a loop in VBA which will insert 10 numbers into a column, starting with the value of the scroll bar and increasing by 5 each time.
> - The main idea is to show how to select cells and to show the grammar of a loop