Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
How do you select an item on a user form?
This is incorrect - txbFaceAmt.Select But it would be great if this worked. |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Try
Me.txbfaceamt.SetFocus Brad wrote: How do you select an item on a user form? This is incorrect - txbFaceAmt.Select But it would be great if this worked. -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Unfortunately that didn't work - when I put in
me.facecheck.setfocus - it gave an error facecheck.setfocus - didn't do anything. Code Sub txbFaceAmt_Exit(ByVal Cancel As MSForms.ReturnBoolean) Call FaceLimitCheck(txbFaceAmt) End Sub Sub FaceLimitCheck(Facecheck) If Not (Facecheck = vbNullString) Then If Not (IsNumeric(Facecheck)) Then MsgBox ("Invalid entry please use numbers") Facecheck.Value = "" Facecheck.SetFocus Else If Facecheck < 25000 Then MsgBox ("Minimum face amount is 25,000") Facecheck.Value = "" Else Facecheck.Value = Format(Facecheck, "$ #,##0,000") End If End If End If Call CheckTotalFace End Sub -- Wag more, bark less "Dave Peterson" wrote: Try Me.txbfaceamt.SetFocus Brad wrote: How do you select an item on a user form? This is incorrect - txbFaceAmt.Select But it would be great if this worked. -- Dave Peterson . |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
What is facecheck?
I thought you wanted to set the focus to txbfaceamt? ====== But even simpler would be to change that FaceLimitCheck into a Function that returns a boolean--if it's ok, then return true Then you could use: Sub txbFaceAmt_Exit(ByVal Cancel As MSForms.ReturnBoolean) dim OkToLeave as boolean oktoleave = FaceLimitCheck(txbFaceAmt) if oktoleave = true then 'do nothing else cancel = true 'don't leave txbfaceamt end if End Sub This: if oktoleave = true then 'do nothing else cancel = true 'don't leave txbfaceamt end if Can be replace with a single line: cancel = (not oktoleave) Brad wrote: Unfortunately that didn't work - when I put in me.facecheck.setfocus - it gave an error facecheck.setfocus - didn't do anything. Code Sub txbFaceAmt_Exit(ByVal Cancel As MSForms.ReturnBoolean) Call FaceLimitCheck(txbFaceAmt) End Sub Sub FaceLimitCheck(Facecheck) If Not (Facecheck = vbNullString) Then If Not (IsNumeric(Facecheck)) Then MsgBox ("Invalid entry please use numbers") Facecheck.Value = "" Facecheck.SetFocus Else If Facecheck < 25000 Then MsgBox ("Minimum face amount is 25,000") Facecheck.Value = "" Else Facecheck.Value = Format(Facecheck, "$ #,##0,000") End If End If End If Call CheckTotalFace End Sub -- Wag more, bark less "Dave Peterson" wrote: Try Me.txbfaceamt.SetFocus Brad wrote: How do you select an item on a user form? This is incorrect - txbFaceAmt.Select But it would be great if this worked. -- Dave Peterson . -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I see where you used FaceCheck.
I'd still use the Cancel argument that's built into the _exit procedure. Dave Peterson wrote: What is facecheck? I thought you wanted to set the focus to txbfaceamt? ====== But even simpler would be to change that FaceLimitCheck into a Function that returns a boolean--if it's ok, then return true Then you could use: Sub txbFaceAmt_Exit(ByVal Cancel As MSForms.ReturnBoolean) dim OkToLeave as boolean oktoleave = FaceLimitCheck(txbFaceAmt) if oktoleave = true then 'do nothing else cancel = true 'don't leave txbfaceamt end if End Sub This: if oktoleave = true then 'do nothing else cancel = true 'don't leave txbfaceamt end if Can be replace with a single line: cancel = (not oktoleave) Brad wrote: Unfortunately that didn't work - when I put in me.facecheck.setfocus - it gave an error facecheck.setfocus - didn't do anything. Code Sub txbFaceAmt_Exit(ByVal Cancel As MSForms.ReturnBoolean) Call FaceLimitCheck(txbFaceAmt) End Sub Sub FaceLimitCheck(Facecheck) If Not (Facecheck = vbNullString) Then If Not (IsNumeric(Facecheck)) Then MsgBox ("Invalid entry please use numbers") Facecheck.Value = "" Facecheck.SetFocus Else If Facecheck < 25000 Then MsgBox ("Minimum face amount is 25,000") Facecheck.Value = "" Else Facecheck.Value = Format(Facecheck, "$ #,##0,000") End If End If End If Call CheckTotalFace End Sub -- Wag more, bark less "Dave Peterson" wrote: Try Me.txbfaceamt.SetFocus Brad wrote: How do you select an item on a user form? This is incorrect - txbFaceAmt.Select But it would be great if this worked. -- Dave Peterson . -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
userform question | Excel Discussion (Misc queries) | |||
UserForm Question | Excel Discussion (Misc queries) | |||
UserForm Question | Excel Worksheet Functions | |||
Another Userform question. | Excel Discussion (Misc queries) | |||
Userform Question | Excel Discussion (Misc queries) |