Forum Discussion
How do we capture numeric input from an Excel Userform textbox?
The code looks OK. See the attached demo workbook.
Have you defined CurrentCheckBox correctly?
- LemonPeelerAug 28, 2022Copper Contributor
Hello Hans, thank you so much again for the effort you went to in order to provide a sample using our exact userform control names. It was extremely easy to follow that way and helpful in confirming that the code we were using for resizing the checkbox should have been working fine. Your short example left us comfortable in redirecting our attention elsewhere looking for the problem. In our case, selecting the option did nothing, so we suspect there is some other mistake that is aborting the operation, before it is performed, without any error messages. Thank you again for taking the time to confirm the code was working fine.
- LemonPeelerAug 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?