Hi,
i have got code:

Dim numbers(99) As String
Dim howmany As String

Private Sub Command1_Click()
howmany = InputBox("how many number you want input?")

For x = 1 To howmany

    numbers(x) = InputBox("Enter a number")
    
Next x

FontSize = 14

For y = 1 To howmany

Print numbers(y)

Next y

End Sub

Private Sub Command2_Click()

For x = 1 To howmany
Set total = total + numbers(x)

Print total
Next x

End Sub

and now i would like to add total numbers printed after clicking Command2_click button, can someone help me?
I would like to print or display answer in msgbox

Hi,

Hi Change your Command2_click code like this :

Private Sub Command2_Click() For x = 1 To howmanySet total = total + numbers(x) Print totalNext x End SubDim numbers(99) As String
Dim howmany As String

Private Sub Command1_Click()
howmany = InputBox("how many number you want input?")

For x = 1 To howmany

    numbers(x) = InputBox("Enter a number")
    
Next x

FontSize = 14

For y = 1 To howmany

Print numbers(y)

Next y

End Sub

Private Sub Command2_Click()
Dim x As Integer
Dim MyTotal as Double
MyTotal = 0
For x = 1 To howmany
    MyTotal = MyTotal + numbers(x)
Next x
Print "Total Is : " & MyTotal
Msgbox "Total Of All the Entered Numbers Is : " & MyTotal
End Sub

Regards
Veena

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.