If it is how do I convert the user input for the text box field as number. thx
If it is how do I convert the user input for the text box field as number. thx
Last edited by JohnSeito; 04-01-2009 at 07:46 AM.
Hi John,
It depends on where your textbox is. If it's a textbox on a sheet, and it is linked to a cell (let's say A1), then you could use the VALUE() function to convert it to a number, e.g.
=VALUE(A1)*60
If it is on a UserForm, and you're referencing it via VBA, use the Val() function to convert it, e.g.
Although myVal = Textbox1.Value * 60 should also work.Please Login or Register to view this content.
Hope that helps!
Last edited by Paul; 03-31-2009 at 10:12 PM.
The default is a string. There are are several options depending on the numeric type required, Use the Type Conversion Functions
CCur(TextBox1.Value) - Currency
CDbl(Me.TextBox1).Value - Double
CInt(Me.TextBox1.Value) - Integer
CDate(Me.TextBox1).Value-Date
See the VBA Help files
Hope that helps.
RoyUK
--------
For Excel Tips & Solutions, free examples and tutorials why not check out my web site
Free DataBaseForm example
pjoaquin and royUK
thanks for the help. So far I don't have that string problem any more. I am still working on the program and well see it any other issues arise. As of now the string problem is resolved. thanks.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks