View Single Post
  #3   Report Post  
Dave Peterson
 
Posts: n/a
Default VBA defining variables

One way is to pass the value:

Sub TestMacro2()
Dim JJ As Double
JJ = 33
Call Macro5(jj)
Call Macro6(jj)
End Sub

sub macro5(myVal as double)
msgbox myVal
end sub

sub macro6(myothervalue as double)
msgbox myothervalue
end sub



Jeff wrote:

Hi

I have the code below. I set JJ=33, and I need Macro5 and Macro6 to use the
variable JJ. But when it goes into those macros JJ is empty. Do you know
how to fix this?

Sub TestMacro2()
Dim JJ As Double
JJ = 33
Call Macro5
Call Macro6
End Sub

Thanks for your help


--

Dave Peterson