ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Row Number of Max Value (https://www.excelbanter.com/excel-programming/342236-row-number-max-value.html)

GreenInIowa

Row Number of Max Value
 
Hi,

I have an array and would like to get the "column" number of the maximum
value in that array. I can get the address of max value by "maxval =
n.Address(maxvalue)" as $E$1, but I would like to get column the number as
numerical value. I tried "colnum = n.Column(maxvalue)" and it is not working.

Any suggestions how I can get column number?

Thanks.

Bernie Deitrick

Row Number of Max Value
 
If maxvalue is a range object:

Dim myCol As Integer
myCol = maxvalue.column

But since maxval is a variable with an address string:

Dim myCol As Integer
myCol = Range(maxval).column

HTH,
Bernie
MS Excel MVP


"GreenInIowa" wrote in message
...
Hi,

I have an array and would like to get the "column" number of the maximum
value in that array. I can get the address of max value by "maxval =
n.Address(maxvalue)" as $E$1, but I would like to get column the number as
numerical value. I tried "colnum = n.Column(maxvalue)" and it is not
working.

Any suggestions how I can get column number?

Thanks.




GreenInIowa

Row Number of Max Value
 
Thanks, Bernie.


"Bernie Deitrick" wrote:

If maxvalue is a range object:

Dim myCol As Integer
myCol = maxvalue.column

But since maxval is a variable with an address string:

Dim myCol As Integer
myCol = Range(maxval).column

HTH,
Bernie
MS Excel MVP


"GreenInIowa" wrote in message
...
Hi,

I have an array and would like to get the "column" number of the maximum
value in that array. I can get the address of max value by "maxval =
n.Address(maxvalue)" as $E$1, but I would like to get column the number as
numerical value. I tried "colnum = n.Column(maxvalue)" and it is not
working.

Any suggestions how I can get column number?

Thanks.






All times are GMT +1. The time now is 09:53 PM.

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