Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default How can I save variable when 'end'? The user then reactivates the

I auto_open a macro, set variables then exit the mcro to allow users to
directly enter values in the worksheet. When they are through they press a
button that reactivates the aarco. My problem is the variablest that I have
set are lost. Is there a way to save these variables. I currently save then
in portion of a work sheet the user does not see. I would like a better way.
thanks for the help
OlieH
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 527
Default How can I save variable when 'end'? The user then reactivates the

Olie

I always save to a hidden sheet, it seems the easiest way. I you do not want
the user to see the sheet you can set it to Very Hidden with VB so the user
wil not see the sheet in the list of hidden sheets. You will have to unhide
the sheet again using a macro.

Regards
Peter Atherton

"OlieH" wrote:

I auto_open a macro, set variables then exit the mcro to allow users to
directly enter values in the worksheet. When they are through they press a
button that reactivates the aarco. My problem is the variablest that I have
set are lost. Is there a way to save these variables. I currently save then
in portion of a work sheet the user does not see. I would like a better way.
thanks for the help
OlieH

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 39
Default How can I save variable when 'end'? The user then reactivates

Thanks for the reply Peter/Billy.

"Billy Liddel" wrote:

Olie

I always save to a hidden sheet, it seems the easiest way. I you do not want
the user to see the sheet you can set it to Very Hidden with VB so the user
wil not see the sheet in the list of hidden sheets. You will have to unhide
the sheet again using a macro.

Regards
Peter Atherton

"OlieH" wrote:

I auto_open a macro, set variables then exit the mcro to allow users to
directly enter values in the worksheet. When they are through they press a
button that reactivates the aarco. My problem is the variablest that I have
set are lost. Is there a way to save these variables. I currently save then
in portion of a work sheet the user does not see. I would like a better way.
thanks for the help
OlieH

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default How can I save variable when 'end'? The user then reactivates the

I think you should rewrite your code so that you don't use that End statement
(not end with, not end if--just the plain old End).

Then your static variables will still hold their values.

On the other hand, lots of things can go wrong. I would include a routine that
would repopulate those variables.



Add one more public/static variable:

Public VariablesAreInitialized as boolean

Then later you can use:

if variablesareinitialized then
'keep going
else
call dedicatedroutinetoinitializevariables 'not rely on Auto_open
end if

sub dedicatedroutinetoinitializevariables()
set TWB = somethingoranother
...all you need
variablesareinitialized = true
end sub

just in case something unexpected goes wrong.

(or
if twb is nothing then
call dedicatedroutinetoinitializevariables
end if

OlieH wrote:

I auto_open a macro, set variables then exit the mcro to allow users to
directly enter values in the worksheet. When they are through they press a
button that reactivates the aarco. My problem is the variablest that I have
set are lost. Is there a way to save these variables. I currently save then
in portion of a work sheet the user does not see. I would like a better way.
thanks for the help
OlieH


--

Dave Peterson
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
Is there some 'secret' to getting 'End' to work when stopping func msnyc07 Excel Worksheet Functions 1 March 26th 10 06:57 PM
How do I remove the 'end' function in Excel 2003? David R Excel Worksheet Functions 5 July 27th 07 09:36 PM
Save button, VBA protected, allow user to define where to save [email protected] Excel Programming 2 June 1st 07 02:00 PM
prompt user to save file as {desired_name} and save it to a variab GeneWan Excel Programming 1 January 5th 07 06:46 AM
VSB code - 'Home' & 'CTRL+End' Corey Excel Discussion (Misc queries) 9 February 9th 06 08:10 PM


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