Excel Custom Formats

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to create a custom format for a postal code. I have a postal code entered in the format of: A1A1A1 and I would like to create the custom format so it looks like this: A1A-1A1. I don't know how to do this with letters. I can do this with all numbers. The letters are all different. Any help I find is to enter text within the cell. I want don't want to entere text. I do not know how to enter individual various letters into the format. Can someone help me solve this?
 
As far as I know, you can't do this.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


Rundownrover said:
I am trying to create a custom format for a postal code. I
have a postal code entered in the format of: A1A1A1 and I would
like to create the custom format so it looks like this: A1A-1A1.
I don't know how to do this with letters. I can do this with all
numbers. The letters are all different. Any help I find is to
enter text within the cell. I want don't want to entere text. I
do not know how to enter individual various letters into the
format. Can someone help me solve this?
 
Hi
if you have characters in your cell: no chance to do this with a custom
format (would work only for numbers). The only thing which could work
would be to use an event procedure (the worksheet_change event) and
change the cell value after your data entry. e.g. put the following
code in your worksheet module (not in a standard module):

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Intersect(Range("A1:A100"), Target) Is Nothing Then Exit Sub
on error goto errhandler
With Target
If len(.Value)=6 Then
Application.EnableEvents = False
.value = left(.value,3) & "-" & right(.value,3)
End If
End With

errhandler:
Application.EnableEvents = True
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany

Rundownrover said:
I am trying to create a custom format for a postal code. I have a
postal code entered in the format of: A1A1A1 and I would like to create
the custom format so it looks like this: A1A-1A1. I don't know how to
do this with letters. I can do this with all numbers. The letters are
all different. Any help I find is to enter text within the cell. I
want don't want to entere text. I do not know how to enter individual
various letters into the format. Can someone help me solve this?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top