keyascii

  1. L

    Sub for keypress check

    Hi! Well i have a question for check keypress for multiple textbox with public sub. Heres example how i have done it now for each textbox. Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) KeyAscii = KeyAscii * -CLng(Chr(KeyAscii) Like "[0-9]") End Sub So i would like...
  2. L

    Textbox numerical input

    Hi I have the following code which accepts numbers 0-9 in a textbox. Private Sub txtb_Amount_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) Select Case KeyAscii Case Asc("0") If txtb_Amount.Value = 0 Then KeyAscii = 0 Case Asc("1") To...
  3. A

    Text box Exit event fails

    Having trouble getting my text box to behave. I want to restore the original text (which always will exist), if the user exits entering nothing. Also limit the input to numbers only. That bit works ok, as does the Change event. The Exit event is the problem. Even though Len = 0 and tmpText...
  4. K

    Need help; trying to figure out why I am getting an error with a leading decimal point in field on userform

    It only trips an error when I "tab" into the field (upon which it turns blue) and then if a decimal point is entered as the first character I get: "Run-time error '13:' Type mismatch" If I use the backspace key to remove any numerals that might be in the field, and then hit decimal (but its...
  5. N

    What is Alternate method to change Focus from TextBox to another Control ?

    What is Alternate method to change Focus from TextBox to another Control whose following properties are Textbox1.EnterKeyBehaviour = True Textbox1.MultiLine = True Following does not Trigger to set focus on another control Private Sub Textbox1_KeyPress(ByVal KeyAscii As...
  6. N

    Pressing Enter Key in Textbox1. The row height increases of the worksheet cell

    When pressing Enter Key in Textbox1. The row height increases of the cell. How can this be prevented ? Textbox1.multiline = True Private Sub Textbox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) If KeyAscii = 13 Then 'The ENTER key. SendKeys "{tab}" 'Set the focus to the...
  7. N

    Slight modification required

    Hello Slight modifciation required from below code. I want to enter the text in textbox with Numeric Values with "-" For eg Date 22-09-2009 what will be the change in the below code to acheive with numeric values and "-" KeyAscii = -KeyAscii * CLng(Chr(KeyAscii) Like "#") If KeyAscii =...
  8. kelly mort

    Discard unauthorized characters with keypress event

    I have used this code to discard all characters except numbers. Now I want to allow the input of points too but I can't make it happen. Can someone fix it for me? Private Sub TextBox1_KeyPress (ByVal KeyAscii As MSForms.ReturnInteger) KeyAscii = KeyAscii * -CLng(Chr(KeyAscii) Like...
  9. H

    Time textbox on userform

    Hi All I am trying to implement a textbox on a form that enables a user to enter a time e.g. 070000. Once I can do that i will try to allow colons in the appropriate places. In the first phase, if any other characters that 0-9 are entered they will be invalid and removed from the textbox. I...
  10. A

    use a function in multiple textbox

    Hi I have a userform with 4 textbox and a function to force users input only number in it. As code below shows, I have to right this function for each textbox keypress event. Now I need to know is this possible to have a loop through userform textboxes to do it? Private Sub...
  11. K

    problem with my code for summing several textboxes together and placing sum in another textbox...

    The code allows for any value > than 0, and use of 1 decimal. The problem is it does not like when the decimal is the first character entered. I get error: "Run time error '13': Type mismatch" What do I need to change so that it allows a decimal to be entered as the first character? I have...
  12. I

    several textbox using only with numbers

    Hello everyone I have 4 textbox used only for values(numbers-cash). I use the code below for each textbox. Is it possible to elaborate a macro, and how, to avoid repeating the codes for each textbox? Thank you for your cooperation. Private Sub TextBox4_KeyPress(ByVal KeyAscii As...
  13. I

    Force only numbers entry in textbox userform

    Hy, I have this code which works fine when you manualy type the information allowing only numbers. If I use the paste function in the textbox("DN") userform I can enter everything, letters ... . The code bellow is set to KeyPress, is it possibile to verify the textbox when I click a button or...
  14. R

    won't let me format with textbox

    On this userform I have been working on, basically I have TextBox1 + TextBox2 = Subtotal, Then subtotal + TextBox3 = Grand Total Which the code looks like this Private Sub TextBoxSum() Dim Total As Double Total = 0 If Len(TextBox1.Value) > 0 Then Total = Total + Val(TextBox1Value)...
  15. A

    KeyAscii key restrictions with named range

    I have been using the following code to only allow the user to enter numbers into a text box on a userform. I am needing to use a similar code to this on a named range to restrict the user from entering certain characters. I am not too sure how to manipulate the following code to make it work...

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top