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: 65
Default retaining variable values across modules

If I want to keep a variable in memory through several macros, I can
retain the variable value if I dim it above the subroutines in the
module

So, in module 1:

Dim String1 as String

Sub test1()
string1 = " test"
end sub

sub test2()
msgbox string1
end sub

the value of string1 is retained into sub test2, test 3, etc

However, all my attempts to retain the value of string1 from module 1
to another module nulls the value of string1.

How do I maintain the value of a variable across modules, not only
within a module?

Art
 
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
Inserting and retaining an input variable ARGT Excel Discussion (Misc queries) 4 June 26th 08 11:42 PM
merge two cel into ONE retaining the two values victork Excel Discussion (Misc queries) 2 February 20th 08 10:13 PM
VBA variables retaining their values GeorgeJ Excel Discussion (Misc queries) 2 August 17th 07 02:19 AM
Retaining Values in Userform when called a second time ExcelMonkey Excel Programming 2 May 3rd 07 03:55 PM
variable retaining value between subroutins question Barmaley Excel Programming 2 September 27th 03 03:50 PM


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