![]() |
setfocus after a msgbox
exit subroutine.... you know what ... i think i am going at this th wrong way... i should really check for mouse or key events then validate the entry. what do you propose? Thank -- simpleMo ----------------------------------------------------------------------- simpleMod's Profile: http://www.excelforum.com/member.php...fo&userid=1572 View this thread: http://www.excelforum.com/showthread.php?threadid=27245 |
setfocus after a msgbox
Yes, I get it there too.
Personally, I avoid the Exit event, too problematical, and better to trap input, like this Private Sub BoxWeightTextBox_KeyPress(ByVal KeyAscii As _ MSForms.ReturnInteger) Select Case True Case KeyAscii = Asc("0"): 'OK Case KeyAscii <= Asc("9"): 'OK Case ".": 'OK Case Else: Interaction.Beep KeyAscii = 0 End Select End Sub You can also add bound checking at the end like this Private Sub BoxWeightTextBox_BeforeUpdate(ByVal Cancel As _ MSForms.ReturnBoolean) With BoxWeightTextBox If CDbl(.Text) < 1 Or CDbl(.Text) 100 Then MsgBox "Value must be Int between 1 and 100." .SelStart = 0 .SelLength = Len(.Text) Cancel = True End If End With End Sub -- HTH RP "simpleMod" wrote in message ... exit subroutine.... you know what ... i think i am going at this the wrong way... i should really check for mouse or key events then validate the entry. what do you propose? Thanks -- simpleMod ------------------------------------------------------------------------ simpleMod's Profile: http://www.excelforum.com/member.php...o&userid=15724 View this thread: http://www.excelforum.com/showthread...hreadid=272454 |
All times are GMT +1. The time now is 10:01 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com