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

Hi,

I've got a startup Sub which has a msgbox with Y/N option. Thereafte
it shows the Application.GetOpenFilename option and the file names ar
stored to variables. Then I've got a userform that has comboboxes i
it and after this private Sub is over, I need the variables that
created in the startup Sub. These variables show Empty in the Watc
section or it shows an Out of Subscript error.

How can I keep these variables static so that I can use it later. I'v
tried using Static, but it does not help

Txs

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Static variables

Use a variable declared as Public at the top of a general module (and above
any subs or functions).

--
Regards,
Tom Ogilvy

"lynnnow " wrote in message
...
Hi,

I've got a startup Sub which has a msgbox with Y/N option. Thereafter
it shows the Application.GetOpenFilename option and the file names are
stored to variables. Then I've got a userform that has comboboxes in
it and after this private Sub is over, I need the variables that I
created in the startup Sub. These variables show Empty in the Watch
section or it shows an Out of Subscript error.

How can I keep these variables static so that I can use it later. I've
tried using Static, but it does not help

Txs.


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Static variables

lynnnow,
You need to understand the concept of "Scope". Check Help.

NickHK

"lynnnow " wrote in message
...
Hi,

I've got a startup Sub which has a msgbox with Y/N option. Thereafter
it shows the Application.GetOpenFilename option and the file names are
stored to variables. Then I've got a userform that has comboboxes in
it and after this private Sub is over, I need the variables that I
created in the startup Sub. These variables show Empty in the Watch
section or it shows an Out of Subscript error.

How can I keep these variables static so that I can use it later. I've
tried using Static, but it does not help

Txs.


---
Message posted from http://www.ExcelForum.com/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Static variables

If all fails, you can store such variables in a worksheet. Leave it as "very
hidden" and pass the variables to the cells.
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
Not at all clear on use of variables and/or object variables JMay-Rke Excel Discussion (Misc queries) 11 July 4th 08 06:36 PM
Static y-axis quattda Charts and Charting in Excel 2 September 4th 07 08:48 AM
Static Row DY New Users to Excel 5 September 9th 05 12:36 AM
Static Cenll WayneB Excel Worksheet Functions 2 February 8th 05 06:09 PM
Static variables lynnnow Excel Programming 0 August 6th 04 01:07 AM


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