Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 358
Default Passing value of variant

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 358
Default Passing value of variant

Hi Tom,

I've tried putting that statement in both the module and code on the form.
I have a watch on 'x' and when the code goes back to the module code the
watch value goes to '<out of context'
--
Andrew


"Tom Ogilvy" wrote:

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




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Passing value of variant

Well, I didn't say anything about putting it (the declaration) in the code
on the form.

That just defeats the whole purpose.

--
Regards,
Tom Ogilvy

"Andrew" wrote in message
...
Hi Tom,

I've tried putting that statement in both the module and code on the form.
I have a watch on 'x' and when the code goes back to the module code the
watch value goes to '<out of context'
--
Andrew


"Tom Ogilvy" wrote:

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






Reply
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
Variant owl527[_5_] Excel Programming 2 October 14th 05 09:37 PM
using find with variant? Don S Excel Programming 4 August 16th 05 04:52 PM
Passing variant arrays to C/C++ dll's agarwaldvk[_35_] Excel Programming 0 October 18th 04 01:33 AM
Variant as matrix curious Excel Programming 5 June 2nd 04 04:18 PM
Variant Array Steph[_3_] Excel Programming 1 June 2nd 04 01:29 AM


All times are GMT +1. The time now is 03:09 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"