View Single Post
 
Old 04-17-2012, 01:23 AM
Colin Legg's Avatar
Colin Legg Colin Legg is offline Windows 7 32bit Office 2010 32bit
Expert
 
Join Date: Jan 2011
Location: UK
Posts: 369
Colin Legg will become famous soon enough
Default

Textboxes contain string data types. If your users are entering numbers then you can explicitly convert the string into a number (numbers in worksheets are always double data types), for example:
Code:
Private Sub TextBox1_Change()
    Sheets("Sheet1").Range("B25").Value = CDbl(Me.TextBox1.Value)
End Sub
or
Code:
 
Private Sub TextBox1_Change()
    Sheets("Sheet1").Range("B25").Value = Val(Me.TextBox1.Value)
End Sub
If that's what you need then you need to be very careful about what the user may enter into the textbox. You might want to research restricting the characters the user can use to 0 through to 9.
Reply With Quote