Simple VBA Question

johngio

Board Regular
Joined
Jan 28, 2005
Messages
174
Hi all,

I'm trying to create a column that displays the minimum value from 3 columns, however I want to display the minimum NON ZERO value.

At the moment I have:

Dim myRange As Range
Set myRange = Worksheets("Sheet1").Range(Cells(iRow - 1, 7), Cells(iRow - 1, 9))

Cells(iRow - 1, 1) = Application.WorksheetFunction.Min(myRange)


Can someone enlighten me as to how to change this so it shows the minimum NON ZERO value please?

Thanks

John
 

Some videos you may like

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

johngio

Board Regular
Joined
Jan 28, 2005
Messages
174
I have kind of solved this question.

I have just put a condition at the beginning of the loop that if the cells = 0, change its value to 1000000, and then at the end of the loop I change it back.

Bit primitive, but seems to do the trick.
 

Watch MrExcel Video

Forum statistics

Threads
1,114,059
Messages
5,545,759
Members
410,704
Latest member
Cobber2008
Top