Excel Worksheet Function Large

J

jswalsh33

I am trying to use the Excel Worksheet Function LARGE in a macro.

My code is Cells(2, 15) = Application.WorksheetFunction.Large(Array, n) in
Excel 2003.

I have tried every way I can think of to write the array but all array
nomenclature I have tried results in a compile error.

Help?

Jim Walsh
 
J

Jacob Skaria

Try the below; with the sample data below

Range("B1") = WorksheetFunction.Large(Range("A1:A10"), 2)

ColA
1
2
3
4
5
6
7
8
10



If this post helps click Yes
 
J

Jacob Skaria

More descriptive form would be

Dim arrTemp As Variant
Dim intTemp as Integer
intTemp = 2
arrTemp = Array(1, 2, 3, 4, 5)
MsgBox WorksheetFunction.Large(arrTemp, intTemp)

OR

Dim rngTemp As Range
Dim intTemp as Integer
intTemp = 2
Set rngTemp = Worksheets("Sheet1").Range("A1:A10")
MsgBox WorksheetFunction.Large(rngTemp, intTemp)

If this post helps click Yes
 

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