Reputation: 902
I'm trying to pass a target.value and target.address to my sub routine, but for some reason i'm getting error "Expected: =".
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
Upvotes: 1
Views: 44
Reputation: 1480
You are missing Call
in front of your function.
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
Upvotes: 1