View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
freekrill freekrill is offline
external usenet poster
 
Posts: 1
Default Declaring variables


Thanks Chip,

I have tried that, but when I then try to sum two of the inputs, it
concatenates instead. A simple example of what I have tried is below.
Thanks for any comments

free

Sub test ()

Dim a as Variant
Dim b as Variant

a = InputBox("Enter A")
If a = "" Then a = 0
b = InputBox("Enter B")
If b = "" Then b = 0
c = a + b
Range("A1").Value = c

End Sub

When I run the macro and enter, say, 1 for A and 2 for B, I get the
value 12 in "A1", rather than 3 which is what I want.


--
freekrill
------------------------------------------------------------------------
freekrill's Profile: http://www.excelforum.com/member.php...fo&userid=7561
View this thread: http://www.excelforum.com/showthread...hreadid=562547