Page 194 - Computer - 10(A&B)
P. 194

To Apply the Function

            Once you have defined the function in BASIC, you can apply it the same way as the built-in functions of Calc.
            Step 1:  Open a Calc document and click in the cell in which you want to enter the function.
            Step 2:   Enter the following:
                     = Add(2, 6)
                     The function is evaluated and you will see the result in the selected cell.

                     You can also use cell reference as arguments.


























            Passing Arguments to a Macro
            Macros can be made to accept arguments in order to perform actions in accordance to them. In most cases you
            will be using a macro to send values or arguments to another macro for further actions which will depend upon
            these arguments that are passed.

            This behaviour allows us to make many smaller macros which perform very specific actions and can be chained
            in a sequence as needed for the solution to a given problem.
            Let’s create a value announcing macro which will read the current cell’s value and then show it in a message
            box to us.
            Step 1:  Create a new Calc workbook.

























            Step 2:   Click on ToolsMacrosOrganize MacrosBasic. The Basic window opens.


               76
   189   190   191   192   193   194   195   196   197   198   199