#1   Report Post  
Posted to microsoft.public.excel.misc
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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
RE-submitting of: constructing (complex) variables with worksheet functions broer konijn Excel Worksheet Functions 0 June 13th 06 11:36 AM
Bubble Charts with two non-numerical variables andy62 Excel Worksheet Functions 2 May 22nd 06 01:08 AM
constructing (complex) variables with worksheet functions broer konijn Excel Discussion (Misc queries) 0 May 16th 06 10:55 PM
VBA reseting variables Jeff Excel Discussion (Misc queries) 0 February 4th 06 08:22 PM
VBA reseting variables bpeltzer Excel Discussion (Misc queries) 0 February 4th 06 03:52 PM


All times are GMT +1. The time now is 12:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"