LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Passing parameters between functions

If you pass them byRef, then if you change them in the function they are
changed in the calling routine. If you pass them byVal then they are not.
byRef is the default and if you don't specify byVal specifically, then they
are passed byRef.

Sub Macro1()
A = 1
B = 2
C = 3
MsgBox "A=" & A & vbNewLine & _
"B=" & B & vbNewLine & _
"C=" & C & vbNewLine

Macro2 A, B, C
MsgBox "A=" & A & vbNewLine & _
"B=" & B & vbNewLine & _
"C=" & C & vbNewLine
End Sub

Sub Macro2(AA, BB, CC)
AA = AA + 10
BB = BB / CC
CC = CC / BB
End Sub

as an example
--
Regards,
Tom Ogilvy


Gaston wrote in message
...
Sorry to bother you guys again, but another question has popped up.
Simple one, but I'm just wondering, if I pass 3 integers into a
function and change the values of all three... when i return to my main
function... do the values of the changed integers remain the same? If
not, how can I make the function do this?
Thanks once again.


---
Message posted from http://www.ExcelForum.com/





 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing parameters Cel Ref) to Sum function Shamshad Butt Excel Discussion (Misc queries) 4 October 26th 05 10:46 AM
Passing parameters Eleanor[_2_] Excel Programming 0 February 4th 04 05:21 PM
Passing parameters to UDF mbobro[_3_] Excel Programming 5 January 2nd 04 04:25 PM
Passing Parameters to Userdefined Functions Peter M[_3_] Excel Programming 3 December 13th 03 07:56 PM
Passing Parameters through OnAction Mark Bigelow Excel Programming 3 September 10th 03 12:53 AM


All times are GMT +1. The time now is 11:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"