我在一组潜艇中使用了以下变量:
Public WeightCap As Double ' Weight capacity
Public HeightCap As Double ' Height capacity
Public WeightRunning As Double ' Weight running total
Public HeightRunning As Double ' Height running total
Public WeightRunningCheck As Double ' Weight running total for check
Public HeightRunningCheck As Double ' Height running total for check
有了这些,我试着按如下方式调用RTFiller子:
HeightRunningCheck = HeightRunning + wsStacker.Cells(iSrcCountLine + 1, 12).Value
WeightRunningCheck = WeightRunning + wsStacker.Cells(iSrcCountLine + 1, 13).Value
RTFiller(HeightRunningCheck, WeightRunningCheck)
因此定义了RTFiller子:
Private Sub RTFiller(HeightTot As Double, WeightTot As Double)
但是,尝试运行它会在RTFiller(HeightRunningCheck, WeightRunningCheck)
行上提示语法错误,当我尝试调试它时,我会收到“编译错误:预期:=”
我一定忘记了一些明显而重要的事情,但我不能为我的生活弄清楚什么。有什么帮助吗?
答案 0 :(得分:2)
您可以使用:
Call RTFiller(HeightRunningCheck, WeightRunningCheck)
或:
RTFiller HeightRunningCheck, WeightRunningCheck
除非你使用Call,或者从函数返回一个值(或者特意试图取消引用/评估其中一个参数),否则你不要使用括号。