Power, Max, Min Functions

J

James

Hi All,

I am trying to convert some VBA code to VB code and have become stuck on the
Power, Max and Min function built into excel.

Does anybody know of any code that will offer the same ability in VB without
reference to the excel dll's

Excel code

Application.power
Application.Max
Application.Min

This is what I need to convert to VB.

Thanks for your help

James
 
A

Andy Wiggins

For POWER use ^ (exponential)

Use IF to test for MAX and MIN, for example,

Sub aa()
Dim a, b
a = 5
b = 6

If a > b Then
Debug.Print a
Else
Debug.Print b
End If
End Sub

OR ...

Sub aaa()
Dim a, b
a = 5
b = 6

Debug.Print IIf(a > b, a, b)

End Sub

--

Regards
Andy Wiggins
www.BygSoftware.com
Home of "Save and BackUp",
"The Excel Auditor" and "Byg Tools for VBA"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top