ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   find minimum non-blank value (https://www.excelbanter.com/excel-programming/427652-find-minimum-non-blank-value.html)

lallen

find minimum non-blank value
 
Hi.

I have a statement which, for a given row, retrieves the value from column
2, of the form:

x = Sheets("Sheet1").Cells(RowNum, 2)

How do I rewrite this to retrieve the minimum non-blank value from columns 2
- 5?

Thanks in advance for your help.

....Larry

Mike H

find minimum non-blank value
 
Try this

x = WorksheetFunction.Min(Sheets("Sheet1").Columns(2))

Mike

"lallen" wrote:

Hi.

I have a statement which, for a given row, retrieves the value from column
2, of the form:

x = Sheets("Sheet1").Cells(RowNum, 2)

How do I rewrite this to retrieve the minimum non-blank value from columns 2
- 5?

Thanks in advance for your help.

...Larry


lallen

find minimum non-blank value
 
Thanks Mike. That wasn't exactly what I was looking for, but it pointed me in
the right direction. What worked for me was:

x = WorksheetFunction.Min(Sheets("Sheet1").Range("B" & RowNum & ":E" &
Rownum))

Thanks again for the quick response.

....Larry

"Mike H" wrote:

Try this

x = WorksheetFunction.Min(Sheets("Sheet1").Columns(2))

Mike

"lallen" wrote:

Hi.

I have a statement which, for a given row, retrieves the value from column
2, of the form:

x = Sheets("Sheet1").Cells(RowNum, 2)

How do I rewrite this to retrieve the minimum non-blank value from columns 2
- 5?

Thanks in advance for your help.

...Larry



All times are GMT +1. The time now is 10:33 PM.

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