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: 244
Default Change variable permanently

I have a macro that makes calculations. In these calculations an error margin
is tolerated. In the spreadsheet the user can press a button and a userform
is shown. In this userform the error margin is shown in textbox. The user can
change the error margin if wanted but the problem is that the change only
lasts as long as the variable lives. As my macro is structured now the
userform is run separately from the actual calculations i.e. any change in
error margin will have no affect on the actual calculations since the
variable will already be dead when the calculation starts. Is there any way
of €śpermanently€ť storing the new value? What I am referring to is some form
of self editing code that changes the value for the variable. The variable
that I use for storing the error margin is a global variable.

Here is code from the userform:

Private Sub UserForm_Initialize()
dblErrorMarginal = 0.00000001
TextBox1.Text = dblErrorMarginal
End Sub

Private Sub changeErrorMargin_Click()
dblErrorMarginal = TextBox1.Text
Unload Me
End Sub

And at the top of the Modul1 where I have the main program:

Public dblErrorMarginal As Double

Please help me solve this problem if it is possible. Thank you very much in
advance!

 
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
how to Permanently change default font for comments jmakow Excel Discussion (Misc queries) 2 December 15th 08 06:27 PM
How do I permanently change the Microsoft Office author? liillith Excel Discussion (Misc queries) 2 July 29th 07 09:30 PM
How do I change $ to ÂŁ permanently in Excel? Maggie's owner Excel Discussion (Misc queries) 1 May 23rd 06 05:08 PM
how do I change a cell permanently to PM from AM? deedee1001us Excel Discussion (Misc queries) 1 June 11th 05 07:03 PM
Permanently change CheckBox control's value use VBA Ilona Excel Programming 1 February 27th 04 10:27 PM


All times are GMT +1. The time now is 08:23 AM.

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"