View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default excel input mask for textbox

I'd use:

Option Explicit
Private Sub IBAN1_BeforeUpdate(ByVal Cancel As MSForms.ReturnBoolean)
With Me.IBAN1
If IsNumeric(.Value) Then
.Value = Format(CDec(.Value), _
"#### #### #### #### #### #### #### #### ##")
Else
Beep
Cancel = True 'don't let them leave the textbox.
End If
End With
End Sub

I switched to _BeforeUpdate, too.

If you have a Cancel button on your userform, make sure its .takefocusonclick is
false.

DaveF wrote:

can anyone help me on this textbox issue:

Private Sub IBAN1_AfterUpdate()

IBAN1.Text = Format(IBAN1.Value, "#### #### #### #### #### ####
#### #### ##")

End Sub

when the user enters numbers, the textbox is change the input.

example 1255 2222 3333 3666 5555 6666 99999 88888 88

1255 2222 3333 3666 0000 0000 0000 0000 00

any ideas


--

Dave Peterson