Public Variable

M

mark

I have a Variable declare in one Sub That I need to use in another Sub.
I tried to declare the variable as public.
But As as soon as I get out of the first sub the variable content disappear.

I tried
_______________________
Public A as Variant
Public B as Variant

Sub first
A= "Fisrt"
End Sub

Sub Second
B = A + ", Second"
End Sub
________________________

Any ideas, I would like the Value of B to be "Fisrt, Second"

Thanks
 
T

Tim Ferguson

Public A as Variant
Public B as Variant

Sub first
A= "Fisrt"
End Sub

Sub Second
B = A + ", Second"
End Sub

first
second
? b
Fisrt, Second


Works for me. Where have you defined this code: you can't put public
declarations in class modules (including behind forms)?

B Wishes


Tim F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top