Page 193 - Computer - 10(A&B)
P. 193
Using a Macro as a Function
Step 1: Open a new workbook.
Step 2: Create a sheet with data as give below.
Step 3: Click on ToolsMacrosOrganize MacrosBasic. The Basic Macros dialog box opens.
Step 4: Click the New button to create a new module. Enter a meaningful name say, Add, and click the OK
button. Calc automatically creates a macro named Main and opens the module for editing.
Step 5: The Code window appears with name ‘Add’. Enter the following code in the code window.
Function Add (a, b)
Add = a+b
End Function
Step 6: Click the Save button to save the macro as a function.
75