Forum Discussion
LemonPeeler
Aug 27, 2022Copper Contributor
How do we capture numeric input from an Excel Userform textbox?
We are using a textbox in an Excel Userform to request numeric input from the user. The two userform text boxes request numbers then used to set the width and height of a new checkbox form control o...
HansVogelaar
Aug 27, 2022MVP
The code looks OK. See the attached demo workbook.
Have you defined CurrentCheckBox correctly?
LemonPeeler
Aug 27, 2022Copper Contributor
In response to your question, yes, we have properly defined CurrentCheckbox. In fact, if we specify constant values such as CurrentCheckBox.Width = 40 and CurrentCheckBox.Height =20 in this routine, everything works fine. The problem seems to be that the user values we are requesting from the userform text boxes are being perceived as text versus numbers, even though they pass the validation test above as a numerical value. Is there some type of statement that will turn a text number into a numeric value before assigning the values to the width and height fields of the checkbox?