【问题标题】:Importing Excel function into my module将 Excel 函数导入我的模块
【发布时间】:2016-02-10 20:58:20
【问题描述】:

我正在使用 VBA,特别是 Excel,并尝试使用 SQRT(平方根)函数。我正在编写一个模块,但不知道如何导入 SQRT 函数,以便我的函数可以使用它。

【问题讨论】:

  • WorksheetFunction.SQRT() 或只是Sqr()。见HERE
  • 作为一个自学成才的 vba 菜鸟,我发现 google 非常有用。就我而言,我用谷歌搜索了“Square root vba”并得到了 scott 为你链接的页面。

标签: excel vba function import reference


【解决方案1】:

这将返回一个平方根:

MsgBox 4 ^ (1 / 2)

【讨论】:

    【解决方案2】:

    这是我的答案, 希望这会有所帮助。

    Function myFunction(rng As Range) As Double
        Dim i As Double
        i = rng.Value
        myFunction = Sqr(i)
        'this function returns the square root of the value of i
    End Function
    

    搜索一下,不费吹灰之力Google show me这个

    1:MS Excel: How to use the SQR Function (WS)

    2:Create SquareRoot Function in VBA - MrExcel.com

    还有更多。

    【讨论】:

      猜你喜欢
      • 2013-10-25
      • 2018-09-28
      • 1970-01-01
      • 1970-01-01
      • 2019-01-10
      • 1970-01-01
      • 2022-11-11
      • 2015-03-05
      • 1970-01-01
      相关资源
      最近更新 更多