View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff Harald Staff is offline
external usenet poster
 
Posts: 292
Default VB to set a constant in another procedure

Hi Ben

Allow me to disagree with Fredrik: Do NOT use public variables unless you
really need them all over the place.

To pass stuff from one piece of code to another; include what you want
passed inside parentheses, like this:

Sub Test()
Call RemoteCode(12, "Yo da man!")
End Sub

Sub RemoteCode(L As Long, S As String)
MsgBox "Number is " & L & vbNewLine & _
"and the message is:" & vbNewLine & S
End Sub

HTH. Best wishes Harald


skrev i melding
oups.com...
I'd like to know if it's possible to use a VBA procedure to set a
variable or constant that will be used by another VBA procedure. I'd
like to do this without referencing a value in a worksheet cell.

Ben