Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Do you mean you want to impose data validation as well as formatting and caps?
Bob's code will do that latter, but not the former. Private Sub Worksheet_Change(ByVal Target As Range) Dim X As String On Error GoTo ws_exit: Application.EnableEvents = False If Not Intersect(Target, Me.Range("A1:H10")) Is Nothing Then With Target X = UCase$(.Value) If X Like "[A-Z][A-Z]## #[A-Z][A-Z]" Then 'it's OK as is ElseIf X Like "[A-Z][A-Z]###[A-Z][A-Z]" Then X = Left$(X, 4) & " " & Right$(X, 3) Else Msgbox "Incorrect format: AA## #AA", vbokonly, "Error!" 'leave the string as-is so they can correct without 'retyping the whole thing End If .Value = X End With End If ws_exit: Application.EnableEvents = True End Sub On Tue, 15 Mar 2005 09:58:22 GMT, "Scott" wrote: I want to know how to format a cell so it only takes the following information... Char.Char,Int,Int <space Int,Char, Char So for example it would look like this... NR01 2RJ I also want the characters changed to capitals if they were entered in lowercase... I'm sure this is an easy one... but I cant find the solution anywhere... Scott |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Format of Postcodes | Excel Discussion (Misc queries) | |||
Format of postcodes | Excel Discussion (Misc queries) | |||
Postcodes starting with 0 | Excel Discussion (Misc queries) | |||
Standardising Postcodes | Excel Discussion (Misc queries) | |||
Postcodes | Excel Worksheet Functions |