View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
doc_in_bc[_4_] doc_in_bc[_4_] is offline
external usenet poster
 
Posts: 1
Default Beginner Variable Problem

First Day Learning VBA for Excel. I've written the following su
routine,

Option Explicit

Sub SunnyDay()
Dim Input1
Dim Input2
Dim Total
Input1 = InputBox("Enter the first amount!")
Input2 = InputBox("Enter the second amount!")
Total = Input1 + Input2
MsgBox "The total amount is " & Total
End Sub

Why does the Total Amount of 2+2 display as 22? If I change th
operators to * , / , or - , I get the correct arithmetic answer. Wit
the + I get concatenation instead of addition. Curious.
Cheers
Dodu

--
Message posted from http://www.ExcelForum.com