Forum Discussion
NV
Jul 17, 2022Copper Contributor
Find Minimum Value from a dynamic range
Hi Friends, please help with my requirement. Each block is having some Data. As and when there is a value in the column M, then it should pick the Min/Max value from the next block. For e...
OliverScheurich
Jul 17, 2022Gold Contributor
Sub min()
Dim i As Long
Dim j As Long
Dim k As Long
Dim maxrow As Long
Range("O:O").Clear
Cells(5, 15).Value = "Min"
maxrow = Cells(Rows.Count, 8).End(xlUp).Row
For i = 6 To maxrow
If Cells(i, 13) <> "" Then
j = i + 1
For k = j To maxrow
If Cells(k, 13) <> "" Then
Cells(k, 15).Value = Application.WorksheetFunction.min(Range(Cells(j, 8), Cells(k, 12)))
Exit For
Else
End If
Next k
Else
End If
Next i
End SubMaybe with this code. In the attached file you can click the button in cell Q3 to run the macro.
- NVJul 18, 2022Copper ContributorGreat thanks for the reply. I'll test it out and keep you posted the update. Thanks again.
- NVJul 28, 2022Copper ContributorI felt that i should have given more details on my requirement. Unfortunately, this is not fulfilling my requirement. Hence I've raised another ticket with more details, pls help.