Macro Monday Solution - Find the Min and Max in a Table - Code Included

Опубликовано: 29 Сентябрь 2024
на канале: EverydayVBA
6,032
19

Grab the Free VBA Quick Reference Guide
https://chrisjterrell.com/p/getting-s...
This is the solution Macro Monday 07-18-2016 for finding the Highest and Lowest Number in 10 Random Numbers.

Code:
==================
Sub FindMaxandMin()

Min = 1000
Max = -1000
rw = 10
Do While Cells(rw, 3) __ ""
If Min _ Cells(rw, 3) Then
Min = Cells(rw, 3)
End If

If Max _ Cells(rw, 3) Then
Max = Cells(rw, 3)
End If

rw = rw + 1
Loop

'Stop

MsgBox "Max = " & Max & Chr(13) & "Min = " & Min

End Sub