LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Format Text & Numbers

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I format numbers as text Brenda Excel Worksheet Functions 2 January 19th 10 01:54 AM
format text to numbers Davidm Excel Discussion (Misc queries) 1 June 23rd 09 12:23 PM
Convert numbers from text format to number format merlin68 Excel Discussion (Misc queries) 7 June 20th 07 07:03 PM
Format text to numbers Jamesy Excel Discussion (Misc queries) 3 January 10th 06 07:06 PM
How do i change numbers in text format to number format? Greg New Users to Excel 1 December 14th 04 05:22 PM


All times are GMT +1. The time now is 03:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"