• VBA UDF question (xl2k sr1)

    Author
    Topic
    #441323

    I have a UDF in my personal.xls. I wanted to call it from a module in another workbook, but couldn’t figure out a syntax to make it work. How is this done?

    Thanks,
    Ken

    Viewing 2 reply threads
    Author
    Replies
    • #1059429

      Could you make it an add-in(XLA)…It would make life simpler shrug

    • #1059473

      Yet another option: let’s say that you have a function MyFunc in a module in Personal.xls that takes one argument. You can call it from a module in another workbook as follows:

      Dim a As Single
      a = Application.Run(“Personal.xls!MyFunc”, 10)

      Note that the first (and in this example only) argument to MyFunc is passed as the second argument of Application.Run. You can *not* use something like Application.Run(“Personal.xls!MyFunc(10)”) – it’ll return an error.

      • #1059504

        Thanks Jezza, Rory, and Hans. Got lots of options now.

        Ken

    • #1059472

      You can set a reference to your Personal.xls file in the VBProject for the workbook you wish to use the function in.

    Viewing 2 reply threads
    Reply To: VBA UDF question (xl2k sr1)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: