Public variable in userform

  • Thread starter Thread starter zSplash
  • Start date Start date
Z

zSplash

I have a Public variable ("theRow"), declared in a separate module "Codes".
The trouble is, from myUserform1 code, the public variable is not
"recognized" and I get a "Variable not defined" error. What's the solution?

TIA
 
Post your code it will make things easier for people to see what is going on
----- zSplash wrote: ----

I have a Public variable ("theRow"), declared in a separate module "Codes"
The trouble is, from myUserform1 code, the public variable is no
"recognized" and I get a "Variable not defined" error. What's the solution

TI
 
At the very top of the "codes" module, put in the declaration

Public theRow as String

or AS whatever is appropriate

this should be above any procedure declarations and you should not have
Option Private Module



It should be visible if you declare it that way
 
Perfect, Tom. Thanks so much!

st.

Tom Ogilvy said:
At the very top of the "codes" module, put in the declaration

Public theRow as String

or AS whatever is appropriate

this should be above any procedure declarations and you should not have
Option Private Module



It should be visible if you declare it that way
 

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

Back
Top