Hi, I have a code for the inbox below. The first inbox chooses how many numbers I can sum together, and I want to skip this part, so it just goes to the second inbox. This way I will be able to choose how many digits I want to sum, so I can keep on adding digits until I press "ok", then the textbox, "txtLFWall" will be populated with the result of the sum. By the way, when I press the "ok" there is an error that shows up. Is there anyone that has an idea on how to fix this or how to do it?
Here is the code:
Best Regards
Here is the code:
Code:
Private Sub CommandButton11_Click()
Dim TotalNum As Variant
'Dim TotalNum1 As String
Dim Hits As Long
Dim SumNums As Variant
Dim EnteredNum As Double
'Name = vbNullString
TotalNum = InputBox("How Many Numbers Do You Want to Sum?")
'TotalNum 1 = InputBox("How Many Numbers Do You Want to Sum?")
If TotalNum = "" Then
Exit Sub
End If
For i = 1 To TotalNum
EnteredNum = InputBox("Enter Number Here")
SumNums = SumNums + EnteredNum
Hits = Hits + 1
Next i
' If EnteredNum = vbOK Then
Me.txtLFWall = SumNums
End Sub
Best Regards