View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gord Dibben Gord Dibben is offline
external usenet poster
 
Posts: 22,906
Default formula for Canadian Postal Codes

For new entries you could use event code to change them as you entered them.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Column < 7 Then Exit Sub
On Error GoTo ErrHandler
Application.EnableEvents = False
With Target
.Formula = UCase(Target.Formula)
.Value = (Left(Target.Value, 3) & " " & Right(Target.Value, 3))
End With
ErrHandler:
Application.EnableEvents = True
End Sub

This is event code. Select the sheet tab and "View Code".

Copy/paste the above into that module.

As written operates only on column G........Target.Column < 7

Existing entries in Column G can be changed by selecting each cell and F2 then
ENTER


Gord Dibben MS Excel MVP

On Thu, 25 Jan 2007 13:23:51 -0400, "LB" wrote:

Thanks for the info. I'm not sure how to format the entire column so that
when I type b2j3e6 in one row, then m4y1k9 in another, they change.

lb
"ufo_pilot" wrote in message
...
=IF(A4<"",UPPER(LEFT(A4,3)&" "&RIGHT(A4,4)),"")
this one worked for me

"LB" wrote:

Hi there. Can someone help me out with a formula to go from this:
b3k2m6

too this:
B3K 2M6

capitals included?

I have them all in one column, G.
Thannks.