View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Hawk Hawk is offline
external usenet poster
 
Posts: 23
Default Adding the values of 2 textboxes

The + is concatenating the two values since the default
data type for a textbox is a string. You need to cast the
textbox value to a number. Try this...

Cells(2, 2).Value = CLng(textbox1) + CLng(textboxchange)
-----Original Message-----
I have textbox1 and textboxchange.
I have code which says:

Cells(1,2).value=textbox1 - textboxchange

This works fine, however this doesnt:
Cells(2,2).value=textbox1 + textboxchange

I simply get the value of textbox1 eg 23 plus the value

of textbox change on
the end eg. if txtboxchange=3 the the result is 231.
I'm completly stumped by this. Thanks
--
Cheers,
Ben

Remove your.tonsils to reply
"You only live once but if you do it right once is

enough!"


.