Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel Format Cell - first letter upper case

Is there a way to format a cell so that when I type in "john" it wil
display as "John"
Or if I type in "jOhN" it will display as "John"
The PROPER function works if I refernce it to another cell.

I also want to format a cell to display a Canadian Postal Code so tha
when I type "v9t5t1" it will display as "V9T 5T1" with a space betwee
the T and the 5.

Thank you

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Excel Format Cell - first letter upper case

Worksheet event code

Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Columns(1)) Is Nothing Then
With Target
.Value = WorksheetFunction.Proper(.Value)
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

Right-click the sheet tab, select View Code, and paste the code in.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"i8theburger " wrote in message
...
Is there a way to format a cell so that when I type in "john" it will
display as "John"
Or if I type in "jOhN" it will display as "John"
The PROPER function works if I refernce it to another cell.

I also want to format a cell to display a Canadian Postal Code so that
when I type "v9t5t1" it will display as "V9T 5T1" with a space between
the T and the 5.

Thank you.


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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel Format Cell - first letter upper case

I cannot get that code to work

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Excel Format Cell - first letter upper case

Hi
you have to put it in a worksheet module (as Bob has described it).
What problem did you exactly encounter?

--
Regards
Frank Kabel
Frankfurt, Germany


I cannot get that code to work?


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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel Format Cell - first letter upper case

I followed his directions. Then when I type a word into any cell, I ge
a Microsoft Visual Basic dialog box pop up saying Compile error
Expected: expression

When I click the ok button, the word event is highlighted in the code

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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Excel Format Cell - first letter upper case

Hi
sounds like you also pasted the first line of Bob's posting. Just
insert the lines between the dashed lines below:

'----------
Private Sub Worksheet_Change(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Columns(1)) Is Nothing Then
With Target
.Value = WorksheetFunction.Proper(.Value)
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub
'---------------


--
Regards
Frank Kabel
Frankfurt, Germany


I followed his directions. Then when I type a word into any cell, I
get a Microsoft Visual Basic dialog box pop up saying Compile error:
Expected: expression

When I click the ok button, the word event is highlighted in the

code?


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


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel Format Cell - first letter upper case

Thank you, thank you, and many thanks yous!!

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

V9T 9T1

when you enter this: v9t5t1

Notice the capitals and the space in the middle.

Thanks,

Joh

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

  #8   Report Post  
Posted to microsoft.public.excel.programming
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/


  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel Format Cell - first letter upper case

Thank you, thank you, and many thanks yous!!

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

V9T 9T1

when you enter this: v9t5t1

Notice the capitals and the space in the middle.

Thanks,

Joh

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

  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Excel Format Cell - first letter upper case

Hi
i think I posted a solution for this

--
Regards
Frank Kabel
Frankfurt, Germany


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/

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Upper Case Letters to First Letter Upper, Remaining Letters Lower SueW Excel Discussion (Misc queries) 7 February 25th 10 05:32 PM
1st letter upper case ZIPPOMA NEEDS HELP Excel Discussion (Misc queries) 5 October 15th 08 03:58 AM
Format cell to convert to Upper case widman Excel Discussion (Misc queries) 4 June 3rd 08 08:29 PM
how do I format a cell to display its contents in Upper case? MarcM Excel Discussion (Misc queries) 1 March 8th 07 03:19 AM
How do I change Letter case (lower to Upper) in a spreadsheet??? mineisjosh Excel Discussion (Misc queries) 4 February 20th 05 01:49 AM


All times are GMT +1. The time now is 03:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"