Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel - Visual Basic

Status
Not open for further replies.

rambob

Programmer
Feb 25, 2002
8
US
I'm trying to use the EXCEL function, MIN in a macro. I use the exact syntax from HELP but it still errs. The syntax I'm using is,

myValue = MIN(B59:B71)

The error I get is, "Compile Error, Expected: list separator or )".

Can anybody help?

 
What you are using is the Syntax for the function as used in a worksheet.

The correct VBA syntax is :

myValue = Application.WorksheetFunction.Min(Range("B1:B71"))

Tahnkfully than can be abreviated using a shortcut for the evaluate method :

myValue = [Min(B1:B40)]

A.C.
 
What you are using is the Syntax for the function as used in a worksheet.

The correct VBA syntax is :

myValue = Application.WorksheetFunction.Min(Range("B1:B71"))

Tahnkfully than can be abreviated using a shortcut for the evaluate method :

myValue = [Min(B1:B71)]

A.C.
 
Acron,

Thanks very much...that worked like a charm!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top