ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   textbox ,problems? (https://www.excelbanter.com/excel-programming/295723-textbox-problems.html)

scott t

textbox ,problems?
 
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

Bob Phillips[_6_]

textbox ,problems?
 
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" wrote in message
...
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 Range
Set c = Worksheets("Sheet1").Range("a2")
c.Value = TextBox1
oh ,i have even formated the excell -cell ,still no luck




TroyW[_2_]

textbox ,problems?
 
Scott,

change the line:
c.Value = TextBox1

to:
c.Value = Me.TextBox1.Value

Troy


"scott t" wrote in message
...
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 Range
Set c = Worksheets("Sheet1").Range("a2")
c.Value = TextBox1
oh ,i have even formated the excell -cell ,still no luck




Tom Ogilvy

textbox ,problems?
 
if isnumeric(Texbox1.Value) then
c.Value = cdbl(TextBox1.Value)
else
c.Value = TextBox1.Value
End if


--
Regards,
Tom Ogilvy



"scott t" wrote in message
...
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 Range
Set c = Worksheets("Sheet1").Range("a2")
c.Value = TextBox1
oh ,i have even formated the excell -cell ,still no luck




Roger Dodger[_2_]

textbox ,problems?
 
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



All times are GMT +1. The time now is 08:48 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com