![]() |
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 . . |
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 . . |
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 |
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 |
All times are GMT +1. The time now is 01:49 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com