在excel中使用vba公共函数时自动显示所需的变量

时间:2017-03-04 03:56:58

标签: excel vba user-defined-functions

我正在使用VBA编写用户定义的公共函数,然后在excel中调用这些函数。一个例子是:

Public Function mg(Qg As Double, Ql As Double, Qo As Double, p As Double, t As Double, z As Double, rs As Double, totalgor As Double, rhog As Double, glr As Double) As Double
'input T in degF
    Dim part1 As Double, part2 As Double

    If Qg > 0 Then
        part1 = (Qg)
    ElseIf glr > 0 Then
        part1 = (Ql * glr)
    ElseIf totalgor > 0 And rs > 0 Then
        part1 = (Qo * (totalgor - rs))
    End If
        part2 = (part1 * z * (14.7 / p) * ((t + 460) / 520) * rhog)
        mg = part2
End Function

当我尝试在excel中调用此函数mg时,因为函数有时会有很多变量,所以不可能记住输入的每个变量,并且返回检查哪个变量需要太多时间应该逐个输入。我想在excel中调用函数时,看到自动显示的变量需要自动显示。 我以前在其他excels中看过这个,但不知道如何在这里实现它。

0 个答案:

没有答案