这一定是一个例行的n00b问题。我从 Test Sub 调用 myTest Sub 但只有完整写出参数的调用。当我将东西作为参数传递时(即 myTest(stuff)),我得到 object required 错误。
任何帮助解决我的难题将不胜感激
Public Sub myTest(Arg1 As Range)
Dim elem As Variant
For Each elem In Arg1
MsgBox (elem.Value)
Next elem
End Sub
Public Sub Test()
Dim stuff As Range
Set stuff = Worksheets(1).Range("D7:D10")
myTest (Worksheets(1).Range("D7:D10"))
'myTest (stuff)
End Sub