Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Using variables across userforms

Please can someone help me out urgently. .

I have created 5 userforms with their respective event handlers (Private
Subs) and while creating these forms I used Public declared variables (one in
each form; all different variable Names)

Now I have created a 6th Form and want to use all five variables but VBA
keeps telling me "variable not found"

Please, is there a way to call and use variables across userforms or modules
within a single VBA project?

Thank you . .

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default Using variables across userforms

Did you declare your variable with a Dim? Are you sure the variable is
there? Are you sure it is spelled correctly?

Please post some code (the code that causes the error).

HTH,
Ryan---

--
Ryan---
If this information was helpful, please indicate this by clicking ''Yes''.


"Genix" wrote:

Please can someone help me out urgently. .

I have created 5 userforms with their respective event handlers (Private
Subs) and while creating these forms I used Public declared variables (one in
each form; all different variable Names)

Now I have created a 6th Form and want to use all five variables but VBA
keeps telling me "variable not found"

Please, is there a way to call and use variables across userforms or modules
within a single VBA project?

Thank you . .

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Using variables across userforms

You could refer to the variables by qualifying them:

Msgbox userform1.myVar1

But I find the simplest thing to do is to move those public variables to a
General module.

Genix wrote:

Please can someone help me out urgently. .

I have created 5 userforms with their respective event handlers (Private
Subs) and while creating these forms I used Public declared variables (one in
each form; all different variable Names)

Now I have created a 6th Form and want to use all five variables but VBA
keeps telling me "variable not found"

Please, is there a way to call and use variables across userforms or modules
within a single VBA project?

Thank you . .


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Using variables across userforms

Dear Dave,

Thanks to all the old posts since 2005 and your input I have solved the
issue of using variables across modules and userforms. Thanks

Though I have a separate issue about ranges will post that shortly

Also thanks to HTH

"Dave Peterson" wrote:

You could refer to the variables by qualifying them:

Msgbox userform1.myVar1

But I find the simplest thing to do is to move those public variables to a
General module.

Genix wrote:

Please can someone help me out urgently. .

I have created 5 userforms with their respective event handlers (Private
Subs) and while creating these forms I used Public declared variables (one in
each form; all different variable Names)

Now I have created a 6th Form and want to use all five variables but VBA
keeps telling me "variable not found"

Please, is there a way to call and use variables across userforms or modules
within a single VBA project?

Thank you . .


--

Dave Peterson

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
Userforms and public variables chuckm Excel Programming 2 February 16th 09 05:45 PM
public variables, 2 userforms Charlie Excel Programming 0 December 25th 07 07:51 PM
Memory problem: Need to set object variables for userforms? Forranges? WHA Excel Programming 0 November 30th 07 03:47 AM
UserForms and Variables and Types of data Larry Levinson Excel Programming 6 April 23rd 04 04:02 PM
Public Variables with UserForms Mark Worthington Excel Programming 3 February 26th 04 12:26 AM


All times are GMT +1. The time now is 03:54 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"