View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Default Value formatting... UK Postcodes

Hi Scott,

Probably better to do it with event code as I don't think any format will
upshift

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("A1:H10")) Is Nothing Then
With Target
.Value = UCase(.Value)
.Value = Left(.Value, 4) & " " & Right(.Value, 3)
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.



--

HTH

RP
(remove nothere from the email address if mailing direct)


"Scott" wrote in message
...
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