Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Sub Main()
- Dim Values() As Integer
- Range("A1").Select
- Do Until ActiveCell.Value = 0
- ReDim Preserve Values(1 To UBound(Values) + 1) As Integer
- Values(UBound(Values)) = ActiveCell.Value
- ActiveCell.Offset(1, 0).Select
- Loop
- Max = WorksheetFunction.Max(Values())
- MsgBox (Max)
- Count = 0
- For Each num In Values()
- If num = 5 Then Count = Count + 1
- Next
- MsgBox "Max: " & Max & vbCrLf & "5 Occurances: " & Count
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement