View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Frank Kabel Frank Kabel is offline
external usenet poster
 
Posts: 3,885
Default Excel Format Cell - first letter upper case

Hi
lets say you enter the values for proper cases in column A and the ZIP
values in column B then try the following event macro

'-----------------
Private Sub Worksheet_Change(ByVal Target As Range)
Dim zip_code
On Error GoTo ws_exit:
Application.EnableEvents = False
with target
select case .column
case 1 'Proper column
.Value = WorksheetFunction.Proper(.Value)
case 2 'Zip code
zip_code = UCase(.value)
zip_code = Left(zip_code,3) & " " & _
Right(zip_code,3)
.value = zip_code
end select
End With

ws_exit:
Application.EnableEvents = True
End Sub



'-------------------

--
Regards
Frank Kabel
Frankfurt, Germany

"i8theburger " schrieb im
Newsbeitrag ...
Thank you, thank you, and many thanks yous!!

My other question was is there a way to format one cell so that it
displays a Canadian Postal code like this:

V9T 9T1

when you enter this: v9t5t1

Notice the capitals and the space in the middle.

Thanks,

John


---
Message posted from http://www.ExcelForum.com/