bobhc
Excel Ninja
Good day All
I have a piece of code to find the maximum value in a column, and I would like to extend it to cover a arrange of A:G.
Sub ExitForDemo()
Dim MaxVal As Double
Dim Row As Long
MaxVal = Application.WorksheetFunction. _
Max(Range("A:A"))
For Row = 1 To Rows.Count
If Range("A1").Offset(Row - 1, 0).Value = MaxVal Then
Range("A1").Offset(Row - 1, 0).Activate
MsgBox "Max value is in Row " & Row
Exit For
End If
Next Row
End Sub
I have a piece of code to find the maximum value in a column, and I would like to extend it to cover a arrange of A:G.
Sub ExitForDemo()
Dim MaxVal As Double
Dim Row As Long
MaxVal = Application.WorksheetFunction. _
Max(Range("A:A"))
For Row = 1 To Rows.Count
If Range("A1").Offset(Row - 1, 0).Value = MaxVal Then
Range("A1").Offset(Row - 1, 0).Activate
MsgBox "Max value is in Row " & Row
Exit For
End If
Next Row
End Sub