(Solved) – ReDim reset value?

(solved)-–-redim-reset-value?

i’ve got a problem with this following code:

Dim Numbers() As Integer
Dim InputNumber As Integer
Dim Tmp_1, Tmp_2 As Integer

Dim Moyenne As Single
Dim Max As Integer
Dim Min As Integer

Sub ITERATIVE_2()
    Tmp_1 = 0
    Tmp_2 = 0

    Do
        InputNumber = InputBox("Série " & Tmp_1 & ". Entrez votre nombre. Pour stopper, entrez 0.")
        If (InputNumber = 0) Then
            MsgBox (" 1")
            Tmp_1 = Tmp_1   1
            Tmp_2 = 0
        Else
            ReDim Numbers(Tmp_1, Tmp_2)
            Numbers(Tmp_1, Tmp_2) = InputNumber
            MsgBox ("Numbers(" & Tmp_1 & ", " & Tmp_2 & ") = " & InputNumber)
            Tmp_2 = Tmp_2   1
        End If
    Loop Until InputNumber = -1

    MsgBox (Numbers(0, 2))
End Sub

This code contain 2 MsgBox.
The first has on output all numbers that I add in Numbers.
The second output has a bad output because the result is everytime “0”.

How can you explain that ? And how can I fix that ? Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *