Create a custom worksheet function in Excel VBA

后端 未结 2 885
时光说笑
时光说笑 2020-12-11 01:46

I have a faint memory of being able to use VBA functions to calculate values in Excel, like this (as the cell formula):

=MyCustomFunction(A3)
2条回答
  •  南笙
    南笙 (楼主)
    2020-12-11 02:15

    The word input needs to be replaced as it is a basic keyword. Try num instead. You can also go further by specifying a type, eg variant.

    Function MyCustomFunction(num As Variant)
        MyCustomFunction = 42 + num
    End Function
    

提交回复
热议问题