View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.newusers
Hile Hile is offline
external usenet poster
 
Posts: 45
Default Formatting cell for state abbreviations

Thank you so much. Can I use a range of columns if I want to apply this
format to more than 1 column on the sheet? If so, do I enclose in () and
separate with commas?
--
Hile


"Gord Dibben" wrote:

Custom formatting works with numbers, not with text strings.

You could use a sheet event.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Column < 1 Then Exit Sub 'adjust the 1 to your column
On Error GoTo ErrHandler
Application.EnableEvents = False
Target.Formula = UCase(Target.Formula)
ErrHandler:
Application.EnableEvents = True
End Sub

This is sheet event code. Right-click on the sheet tab and "View Code"

Copy/paste to that module. Edit column number to suit then Alt + q to
return to the Excel window.

What is typed into the column will be changed to upper case.


Gord Dibben MS Excel MVP

On Tue, 14 Apr 2009 09:53:04 -0700, Hile
wrote:

How do I FORCE the formatting of the cell to capitalize all entries w/o a
formula. I have a column for State that I've placed a validation on to only
accept 2 character entries, I now want it to capitalize whatever entry the
user types in if they don't automatically capitalize the state abbreviation.

I thought of assigning a custom format to the cell but I don't know the
syntax I need to type in for a 2 character all cap entry. The text is not in
there yet, I want it to dynamically capitalize as it is typed in.