Consulting

Results 1 to 3 of 3

Thread: number format

  1. #1
    VBAX Regular
    Joined
    Mar 2009
    Posts
    17
    Location

    number format

    how can i format a textbox which
    starts with specific letter that should be Uppercase and followed by 4 digit numbers.

    ex. A1115

  2. #2
    VBAX Contributor
    Joined
    Jul 2004
    Location
    Gurgaon, India
    Posts
    148
    Location
    Hi,

    [vba]Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
    Const Ptrn As String = "[A-Z]####"
    If Len(Me.TextBox1) Then
    If Not Me.TextBox1 Like Ptrn Then
    MsgBox "Invalid", vbInformation + vbCritical
    Me.TextBox1.Value = ""
    Exit Sub
    End If
    End If
    End Sub[/vba]

  3. #3
    VBAX Regular
    Joined
    Mar 2009
    Posts
    17
    Location
    thank you!
    the code works the way i wanted

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •