【アルゴリズム】 配列データ内の最大値を求める

配列hairetuに"11","22","33","44","55"と入っています。


Private Sub CommandButton1_Click()
Dim hairetu As Variant
Dim i As Long
Dim maxnum As Long

hairetu = Array("11", "99", "22", "33", "44")
maxnum = -1

For i = 0 To UBound(hairetu)
If hairetu(i) > maxnum Then
maxnum = hairetu(i)
End If
Next i

MsgBox maxnum

End Sub

とします。