View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Passing value of variant

use
Public x as Variant

in a general module - the type you get if you do Insert=Module

then it is visible to the entire project.

--
Regards,
Tom Ogilvy

"Andrew" wrote in message
...
Hi,

I have a button on a userform. The userform is displayed after pressing a
button on a worksheet, called from a peice of code.

UserForm1.Show

Upon pressing the button a value is set (eg x = 1).

How do I pass the value for x back to the original code? I have tried

using

'Public x as Variant'.

--
Andrew