我试图将target.value和target.address传递给我的子例程,但由于某种原因我得到错误"预期:="。
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$2" Then
sendToRoutine (Target.Address, Target.Value) <<== Error
End If
End Sub
Sub sendToRoutine ( myTarget as String, myTargetValue as String)
'Do Something with the values....
End Sub
答案 0 :(得分:1)
您在功能面前缺少Call
。
Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$2" Then
Call sendToRoutine(Target.Address, Target.Value) '<<== Not an error
End If
End Sub
Sub sendToRoutine(myTarget As String, myTargetValue As String)
'Do Something with the values....
End Sub