Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 30th, 2008, 02:11 AM
Authorized User
 
Join Date: Jun 2008
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to mona_upm84
Default Find maximum value from several textboxes

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
 
Old July 8th, 2008, 02:21 PM
Registered User
 
Join Date: Jun 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
 
Old July 17th, 2008, 11:50 PM
Authorized User
 
Join Date: Jun 2008
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to mona_upm84
Default

Thanks reneemettrie,

My boss change the requirement in that form, and i did not use any max min function anymore. But anyway, thanks. Maybe somebody out there might need ur idea next time. Thanks!! :D






Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get maximum value from database Manisha0605 .NET Framework 2.0 6 June 17th, 2007 12:50 PM
Maximum Users Brendan Bartley Access 1 March 15th, 2007 02:34 PM
Row Maximum bmains SQL Server 2000 2 October 7th, 2004 08:39 PM
find maximum number Abhinav_jain_mca SQL Server 2000 4 September 28th, 2004 08:13 AM
Finding the maximum and using it outside the IF jrwarwick XSLT 2 October 17th, 2003 03:59 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.