ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Reference in VBA to "Maximum change" Value ?? (https://www.excelbanter.com/excel-programming/424405-reference-vba-maximum-change-value.html)

monir

Reference in VBA to "Maximum change" Value ??
 
Hello;

Following an iteration procedure (e.g.; using GoalSeek or Solver in a
standard macro), it makes sense to avoid equal or zero comparisons or to
introduce a new error tolerance.
For example, if the iteration result from the procedure is res1 within the
"Maximum change" value set at (tol1=) 1.E-6 (or whatever), and I need to
compare res1 with an analytical value val1 using the same tol1: (Excel 2003
SP3, Windows XP)

' tol1 = Maximum change value set under Options
IF abs( res1 - val1) tol1 then
'.... do something
EndIF

How do I extract the value of (or make reference to) the "Maximum change"
value tol ??

Thank you kindly.

monir

Reference in VBA to "Maximum change" Value ??
 
Hi;

This works fine:

tol1 = Application.MaxChange
IF abs( res1 - val1) tol1 Then
'.... do something
EndIF

It couldn't be simpler! Sorry, but I don't have a clue why it didn't work
earlier!

Regards.


"monir" wrote:

Hello;

Following an iteration procedure (e.g.; using GoalSeek or Solver in a
standard macro), it makes sense to avoid equal or zero comparisons or to
introduce a new error tolerance.
For example, if the iteration result from the procedure is res1 within the
"Maximum change" value set at (tol1=) 1.E-6 (or whatever), and I need to
compare res1 with an analytical value val1 using the same tol1: (Excel 2003
SP3, Windows XP)

' tol1 = Maximum change value set under Options
IF abs( res1 - val1) tol1 then
'.... do something
EndIF

How do I extract the value of (or make reference to) the "Maximum change"
value tol ??

Thank you kindly.



All times are GMT +1. The time now is 07:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com