How to call VBA function from Excel cells (2010)?

前端 未结 9 1806
暖寄归人
暖寄归人 2020-11-29 06:11

I defined a few functions in a workbook using VBA, and then expected to be able to use them in a cell formula - but Excel does not recognise the function. I just get #NAME?<

9条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-29 06:50

    If you are using the latest versions of Excel, to see VBA functions in another workbook you need to:

    1. Save your workbooks as .xlsm

    2. Enable macros as suggested above

    3. Set a reference. In VBA (Alt-F11) choose Tools/References, then browse to the workbook which contains the macro you want to use. Check that reference in the list.

      If you get an error message about the module names clashing just rename it in the project explorer first.

提交回复
热议问题