LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Canadian Postal Code format?

Fritz

There is no Custom Format for Canadian Postal codes that I have found.

You can use event code in the worksheet so that as you enter the code, it will
change to A1A 1A1

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Column < 1 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

As written this event code operates on Column A only.

You can type the code in as upper or lower case. Will come out as upper case no
matter what.

Right-click on the sheet tab and "View Code"

Copy/paste the above into that sheet module.

Adjust for your column if needed.

i.e. for just column B edit to If Target.Column < 2 Then Exit Sub


Gord Dibben MS Excel MVP..................and Canuck

On Sun, 22 Jul 2007 20:46:02 -0700, Fritz
wrote:

Thanks that works fine as long as it take 2 cells to do it in. In Access we
used to be able to design a "special format" for such.

"Dave Thomas" wrote:

Use the UPPER function: if "a1b 6c3" (no quotes, of course) is entered in
A1, then in B1, =UPPER(A1) produces A1B 6C3

Regards,

Dave


"Fritz" wrote in message
...
I would like to type is our Canadian Postal Code and have a special format
that forces the right entry. Our Postal Code consists of
3 characcters a space and 3 more character. Ie "S0L 1G9".
It is always a "UPPERCASE LETTER, number, UPPERCASE LETTER, space, number,
UPPERCASE LETTER, number".

I would like to enter it in lower case but have it converted to upper
case.
Is this possible. Thanks





 
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
Cell format for Canadian postal codes mmcstech Excel Discussion (Misc queries) 10 April 21st 23 09:01 PM
formula for Canadian postal codes LB Excel Worksheet Functions 7 July 18th 07 12:07 AM
formula for Canadian Postal Codes LB Excel Worksheet Functions 6 January 25th 07 06:30 PM
Validation of Postal Code Veronika Excel Worksheet Functions 1 December 16th 05 09:42 PM
Using excel 2003 cannot see Canadian Postal Codes PW Excel Worksheet Functions 0 November 8th 05 07:21 PM


All times are GMT +1. The time now is 06:41 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"