Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all,
I have a problem with userform textbox formatting. The end result of data entry is to be shown as 01/01234 or BH/014567 the first two characters is a claim year (can be 01 for 2001etc or BH for really old claim prefix) and the last 5 numbers are a file number (always 5 numbers). Presently the code below allows only numbers for all entries. Another problem is If I enter 01234 it will display as 00/01234, it should display as 01/00234. Code to date as follows Private Sub txtInvClaim_AfterUpdate() With Me.txtInvClaim .Value = Format(.Value, "00/00000") End With End Sub Private Sub txtInvClaim_KeyPress(ByVal keyascii As MSForms.ReturnInteger) Dim OKChar As Boolean OKChar = True If Len(Me.txtInvClaim.Value) = 7 Then OKChar = False Else Select Case keyascii Case Asc("0") To Asc("9") 'ok Case Else OKChar = False End Select End If If OKChar = False Then keyascii = 0 'Beep End If End Sub Any help will be greatly appreciated and many thaxs to all ViViC |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how do I format numbers as text | Excel Worksheet Functions | |||
format text to numbers | Excel Discussion (Misc queries) | |||
Convert numbers from text format to number format | Excel Discussion (Misc queries) | |||
Format text to numbers | Excel Discussion (Misc queries) | |||
How do i change numbers in text format to number format? | New Users to Excel |