View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Shazi Shazi is offline
external usenet poster
 
Posts: 74
Default Textbox Decimile Problem

On Jul 13, 2:55*pm, Mike H wrote:
Maybe

Private Sub txtUnitPrice_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
* Case 8, 9, 27, 45, 46, 48 To 57
* * Case Else
* * * * Beep
* * * * KeyAscii = 0
End Select
End Sub

Mike



"Shazi" wrote:
Hi,


I have a UserForm with many textboxes. the below Procedure is for the
Unit Price Textbox. I put two restrictions on it,


1. * to restrict blank entry
2. * to restrict alphabatical entry


both are working fine, but when I try to enter the value like 23.05
or *135.15 its not accepted. I mean *the value in decimile its not
accepting.


Private Sub TxtUnitPrice_Exit(ByVal Cancel As MSForms.ReturnBoolean)
' to restrict blank entry
* * * * If txtUnitPrice.Text = "" Then
* * * * MsgBox "Sorry, please enter the Unit Price to proceed...."
* * * * Cancel = True
* * * * End If
End Sub


Private Sub txtUnitPrice_KeyPress(ByVal KeyAscii As
MSForms.ReturnInteger)
' * to restrict entry for Numbers only
* * If KeyAscii < Asc("0") Or KeyAscii Asc("9") Then
* * * * Interaction.Beep
* * * * KeyAscii = 0
* * End If
End Sub


if anyone knows how to fix this problem. pls send me the solution, I
will be highly appreciated......


Thanks and regards.


Syed Shahzad Zafar
Madinah- Hide quoted text -


- Show quoted text -


Thank you Mr. Mike, you solved my problem. your code is working
perfectly.
Once again thank you very much for your support.

Regards.

Shahzad