Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
change event help
Hi all,
i have my userform pull up info from cell on initializing, so sometimes the code below works and sometimes it doesn't. what i need to do is use a similar code to delete the unwanted characters on the change event. Private Sub txtItemFob_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) Select Case KeyAscii Case 8 To 10, 13, 27 'Control characters Case 45, 46 'negative and period If KeyAscii = 45 Then 'hypen/negative If Len(Trim(txtItemFob.Text)) 1 Then Beep KeyAscii = 0 End If End If Case 48 To 57 'numbers Case Else 'Discard anything else Beep KeyAscii = 0 End Select End Sub -- help a friend help you |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
change event help
What is the exact problem? Do you need to delete a cell or are you just
getting error messages? "ernie" wrote: Hi all, i have my userform pull up info from cell on initializing, so sometimes the code below works and sometimes it doesn't. what i need to do is use a similar code to delete the unwanted characters on the change event. Private Sub txtItemFob_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) Select Case KeyAscii Case 8 To 10, 13, 27 'Control characters Case 45, 46 'negative and period If KeyAscii = 45 Then 'hypen/negative If Len(Trim(txtItemFob.Text)) 1 Then Beep KeyAscii = 0 End If End If Case 48 To 57 'numbers Case Else 'Discard anything else Beep KeyAscii = 0 End Select End Sub -- help a friend help you |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
change event help
Hi Akphidelt,
thanks for the reply, i tried using the code below to validate user inputs but i doesnt seem to work.. so i want to try it using the change event procedure instead of the keypress. thank you -- help a friend help you "AKphidelt" wrote: What is the exact problem? Do you need to delete a cell or are you just getting error messages? "ernie" wrote: Hi all, i have my userform pull up info from cell on initializing, so sometimes the code below works and sometimes it doesn't. what i need to do is use a similar code to delete the unwanted characters on the change event. Private Sub txtItemFob_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) Select Case KeyAscii Case 8 To 10, 13, 27 'Control characters Case 45, 46 'negative and period If KeyAscii = 45 Then 'hypen/negative If Len(Trim(txtItemFob.Text)) 1 Then Beep KeyAscii = 0 End If End If Case 48 To 57 'numbers Case Else 'Discard anything else Beep KeyAscii = 0 End Select End Sub -- help a friend help you |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
MsgBox in Enter event causes combobox not to run Change event | Excel Programming | |||
Change event and calculate event | Excel Programming | |||
Change Cell from Validated List Not Firing Worksheet Change Event | Excel Programming | |||
change event/after update event?? | Excel Programming |