I'm trying to teach myself the rudiments of passing variables. The following procedure produces a 'Variable not defined' error on line 1. Can anyone explain why this is?
(A1 contains a string)
thanks,
Mark
(A1 contains a string)
thanks,
Mark
Code:
Public Function called(ByRef x As Variant) As Variant
x = ActiveWorksheet.Range("A1").Value
End Function
Public Function calledtwo(ByRef y As Variant)
y = "String2"
End Function
Sub caller()
Dim x As Variant
Dim y As Variant
called x
calledtwo y
MsgBox x & y
End Sub