ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel Worksheet Function Large (https://www.excelbanter.com/excel-programming/432716-excel-worksheet-function-large.html)

jswalsh33

Excel Worksheet Function Large
 
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

Jacob Skaria

Excel Worksheet Function Large
 
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
---------------
Jacob Skaria


"jswalsh33" wrote:

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


Jacob Skaria

Excel Worksheet Function Large
 
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
---------------
Jacob Skaria


"Jacob Skaria" wrote:

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
---------------
Jacob Skaria


"jswalsh33" wrote:

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



All times are GMT +1. The time now is 02:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com