How to pass a cell to the function?

  • Hello,
    I need to create a function to be used in the worksheet and it needs to pass the cell, but it is only passing the value of the cell. Like:
    In the table:
    A1 has value =UPPERCASE("test1")
    B1 has value =MyFunction(A1)


    In the module:

    Code
    Function MyFunction(thecell)
         MsgBox thecell.FormulaLocal
    End Function


    The function should receive the formula "=MyFunction(A1)", but it gives error. When I change it, it only receives the value "TEST1".
    How to make the function pass the cell as an object instead of passing only value?


    Thanks.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!