Quote:
quote:Originally posted by mona_upm84
I am developing a program that need to show the maximum value within textbox1 untill textbox22. It is very hard to compare each of the textbox manually such as:
dim a as double
dim b as double
dim c as double
dim max as double
max = 0.00
a = Me.TextBox1.Text
b = Me.TextBox2.Text
c = Me.TextBox3.Text
...
v= Me.TextBox22.Text
If a>b And a>b And a>c Then
max = a
End If
...
It is too much, and i would like to know if there is any other way to identify maximum floating number within those 22 textboxes, and appear in textbox23 real-time (meaning, result change everytime user keyin different value while macro still running). I really need the solution
Thanks
Mona
|
Maybe you can use the Max function of excel?
In the Access VBA Editor, go to Tools-References and add a reference to Excel.
After that, you can find out the maximum as follows:
Excel.Application.WorksheetFunction.Max(txt1, txt2, txt3,....txt22)
or simply WorksheetFunction.Max(txt1, txt2, txt3,....txt22)
Renée