LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default UNDERSTANDING VARIABLE SCOPE

I am trying to maintain variables value so when I return to a userform that
has already been used, it will already be filled out (as long as the user has
previously visited it. I thought declaring the variables as public at the
module level would make them visible in all subs but it is not working.

In module 3 I have variables declared as public. In the sub, the variables
are not declared because I want to use to publics but they seem to get over
written when they are assigned a value. ie.

MODULE 3
public v1 as string
public v2 as string

private sub MyButton_click()
v1 = "myValue"
v2 = "myValue"
end sub

The watch window shows <Out of context after values have been assigned
inside the sub.

 
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
variable scope mgasparel Excel Programming 2 February 16th 05 05:22 PM
scope/ lifetime of variable jeffP Excel Programming 5 September 19th 04 05:25 AM
scope/ lifetime of variable Norman Jones Excel Programming 0 September 18th 04 12:55 AM
Variable Scope Kevin Excel Programming 1 September 14th 04 07:05 PM
Variable scope TonyM Excel Programming 5 April 24th 04 01:02 PM


All times are GMT +1. The time now is 12:06 PM.

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"