• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Activex Textbox input output value as numeric

Hi Friends,

I am using Activex textbox for input, value of which is later on used in a calculation to generate the report.

- Can you please let me know how to restrict input in the text box as only decimal or whole numbers.
- Also output from the textbox is linked to a cell, which is giving the cell value as text, can you please tell me how to convert it to numeric.
- With one code can i control all the textbox in a workbook, with the above conditions.

Thanks & Regards,
 
Mani
You have to use VBA code which is attached to the textbox
You validation can be as simple or complex as you need
eg:
Code:
Private Sub TextBox1_Change()
If TextBox1.Value < 0 Or TextBox1.Value > 100 Then
  TextBox1.Text = 0
Else
  Range("A1").Value = TextBox1.Value
End If
End Sub

To add, Right Click on the Textbox and select View Code
 
Back
Top