How can you make a postcode have a gap in the middle all down
I like the code, but the code will not be applied to a column, but only cell
D13. how could the code change from
If Target.Column < 7 Then Exit Sub
to just a target cell?
"Gord Dibben" wrote:
Canadian postal code?
To change existing entries.
=UPPER(LEFT(G1,3)&" "&RIGHT(G1,3))
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 'adjust column to suit
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
Gord Dibben MS Excel MVP
On Tue, 3 Feb 2009 03:35:01 -0800, Ianwal
wrote:
Help please as daily we produce a list of addresses and post codes and some
clients put a space between the numbers and some do not. We need a space
always
|