Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / March 2008

Tip: Looking for answers? Try searching our database.

Return Max Value of given Variables

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Keenan Hansen - 03 Mar 2008 22:21 GMT
I have ten variables in my code, and I need to return which variable is the
highest, and what its name is.

Any help is greatly appreciated.
Bob Phillips - 03 Mar 2008 23:08 GMT
You would have to compare one against the other. You could use an array
instead and use the worksheet MAX function on it.

Signature

---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

>I have ten variables in my code, and I need to return which variable is the
> highest, and what its name is.
>
> Any help is greatly appreciated.
Keenan Hansen - 03 Mar 2008 23:30 GMT
I'm currently sending the variable values to the sheet and then comparing any
irregularities against the set's Mode.  I would rather have this run in the
code and not be present in any of the sheet's real estate.

i.e.  
x=2
y=2
z=3
Dim Greatest as String
Greatest = 'code returns "z" as greatest value
msgbox (Greatest) & "is the greatest variable",0,"Variable Info"

> You would have to compare one against the other. You could use an array
> instead and use the worksheet MAX function on it.
[quoted text clipped - 3 lines]
> >
> > Any help is greatly appreciated.
Bob Phillips - 04 Mar 2008 00:07 GMT
So, are you going to test one against another or use an array?

Signature

---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

> I'm currently sending the variable values to the sheet and then comparing
> any
[quoted text clipped - 18 lines]
>> >
>> > Any help is greatly appreciated.
Keenan Hansen - 04 Mar 2008 13:11 GMT
I guess I could write a fairly long set of logical tests, but I was wondering
if there is a quicker way.

> So, are you going to test one against another or use an array?
>
[quoted text clipped - 20 lines]
> >> >
> >> > Any help is greatly appreciated.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.