textbox ,problems?

S

scott t

i'm try to run a textbox in a userform, to an excel worksheet , using the textbox as a number .problem is that when i send the number to excel worksheet ,it comes in a text form, which the number then won't add ,subtract ,divide ,ect
code is
Private Sub TextBox1_change(
Dim c As Rang
Set c = Worksheets("Sheet1").Range("a2"
c.Value = TextBox
oh ,i have even formated the excell -cell ,still no luck
 
B

Bob Phillips

Hi Scott,

It does create a text string in A2, but as it is all numeric, any other math
operations on that cell do an implicit conversion to numeric, so it should
be okay.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

scott t said:
i'm try to run a textbox in a userform, to an excel worksheet , using the
textbox as a number .problem is that when i send the number to excel
worksheet ,it comes in a text form, which the number then won't add
,subtract ,divide ,ect.
 
T

TroyW

Scott,

change the line:
c.Value = TextBox1

to:
c.Value = Me.TextBox1.Value

Troy


scott t said:
i'm try to run a textbox in a userform, to an excel worksheet , using the
textbox as a number .problem is that when i send the number to excel
worksheet ,it comes in a text form, which the number then won't add
,subtract ,divide ,ect.
 
T

Tom Ogilvy

if isnumeric(Texbox1.Value) then
c.Value = cdbl(TextBox1.Value)
else
c.Value = TextBox1.Value
End if


--
Regards,
Tom Ogilvy



scott t said:
i'm try to run a textbox in a userform, to an excel worksheet , using the
textbox as a number .problem is that when i send the number to excel
worksheet ,it comes in a text form, which the number then won't add
,subtract ,divide ,ect.
 
R

Roger Dodger

I have had the same proble
A work around that I came up with was to put the results in a cell and then use the =value(cell) to convert it to a numeric format
 
Top