Page 228 - IT 402 v2.0 class 10
P. 228

Step 6:  Click on the Edit button.

        Step 7:  The My macros Code window will appear on the screen. Click anywhere in the blank space in the
                window.

        Step 8:  To create  a function  Fee that
                displays fee payable  by each
                student every time you use that
                macro, type the following code
                in the code window:
                Function Fee()
                   Fee() = “INR 10,000”

                End Function
        Step 9:  Press Ctrl + S keys to save the
                macro.

        Step 10:   Now, you can just type Fee() in a cell to calculate the fee of a student.
        Passing Arguments to a Macro
        Argument is a way to provide more information to the macro. We can pass arguments to a macro. Basically,
        arguments are the values that are sent to macro. The called function can modify the value of the argument
        by using its reference passed in.

        To illustrate a function that accepts arguments, we will write a macro function that accepts two arguments
        and returns the larger of the two.

        Functions TestMax(x, y)
          If x >= y Then
            TestMax = x
          Else
            TestMax = y
          End If

        End Function






         226       Touchpad Information Technology-X
   223   224   225   226   227   228   229   230   231   232   233