Page 195 - Computer - 10(A&B)
P. 195
Step 3: Type the following code.
All macros in BASIC have to start with “Sub” and end with “End Sub”. Here valueannouncer and
readValue are the names that we want to assign to the macros.
valueannouncer is calling the second macro “readValue” with an argument of oCell.value which as the
name suggests is the active cell’s value; readValue then displays the value.
Step 4: Select the current document and click on New button.
Step 5: Now, go back to your Calc workbook and select a cell which has some data in it.
Step 6: Click on Tools Macros Run Macro option.
Step 7: The Macro selector dialog box appears. Select the macro made earlier valueannouncer and click on Run
button.
Passing the Arguments Areas Value
In Calc, the Areas function returns the number of areas in a given reference. An area is a range of adjacent cells
or a single cell and a reference to a cell or range of cells can refer to multiple selection areas.
Here, we will create a macro to find the number of cells in current selection.
Step 1: Create a new Calc workbook and go to Basic window and type the following code.
77