ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Forms, TextBox (https://www.excelbanter.com/excel-programming/277707-re-forms-textbox.html)

Heapy

Forms, TextBox
 
I tried using a simple assignment function:

Sheets("ShtNm").Range("A1") = UserForm1.TextBox1.Value

.... and got a number. If you want to try something else, try forcing the
conversion of the textbox input to a number using CDbl. ie:

Sheets("ShtNm").Range("A1") = CDbl(UserForm1.TextBox1.Value)

Just be sure to put in appropriate error handling for this in case the user
enters a non-numeric input.

HWH


"Stuart Hodgson" wrote in message
...
I am using a Form to obtain a users input and then taking
those values and inserting them into a spreadsheet. The
problem is that the spreadsheet does not treat the values
as numbers.

I am using activecell.value to insert the values from the
form onto the spreadsheet and have tried using
activecell.numberformat as well as using the onchange
event for the textbox to format the value all to no avail.
If anyone has an answer I would be most grateful.

Many thanks.





All times are GMT +1. The time now is 05:47 AM.

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