Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Input masks in Excel
Hello,
I would like to set up an input mask in Excel for a Canadian Postal code (e.g. T7G 8R4). I am not sure how to do this. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Input masks in Excel
Chris
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 Mon, 16 Oct 2006 10:16:03 -0700, Chris wrote: Hello, I would like to set up an input mask in Excel for a Canadian Postal code (e.g. T7G 8R4). I am not sure how to do this. Gord Dibben MS Excel MVP |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
unhide menu bar in excel - just disappeared | Setting up and Configuration of Excel | |||
macro security too high in excel, I can not get into input data | Excel Worksheet Functions | |||
Trouble with saving user input in an Excel Form. | Excel Discussion (Misc queries) | |||
How to import a text file to Excel treating all input content are in string. | Excel Discussion (Misc queries) | |||
how to input a calculation in excel to find the geometric mean | Excel Worksheet Functions |