Originally Posted by
luv2glyd
Aha! Ok, thank you. I've always done it the way I showed above (though with no more than one variable fed into it). Any idea why I did not have to use "Call", or drop the () ?...
What Mr rorya said is also explained well by Mr shg here
http://www.excelforum.com/excel-prog...ml#post4226271
Jacky
Note I bet in your original
my_macro(var_1)
suggestion, than actually when you pasted that in the VB Editor Window, then it would have changed it to include a space
my_macro (var_1)
which is consistant with the syntax variations suggested to you
Sub CallVariations()
my_macro (var_1) ' this "dereferences or evaluates the argument passed"
my_macro var_1
Call my_macro(var_1)
Call my_macro((var_1)) ' this dereferences or evaluates the argument passed"
my_macro2 (var_1), var_2 ' Var_1 is derefferenced and evaluated
my_macro2 var_1, var_2
Call my_macro2((var_1), var_2) 'Var_1 is derefferenced and evaluated
Call my_macro2(var_1, var_2) '
End Sub
And just to reiterate...
doing this
my_macro (var_1)
or this
Call my_macro((var_1))
makes this
Sub my_macro(ByRef var As Long)
End Sub
work as if you had this
Sub my_macro(ByVal var As Long)
End Sub
or alternatively makes this
Sub my_macro(ByRef var As Long)
End Sub
work as if you sent a number rather than Var_1 at the calling line
Bookmarks