Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Use of Proper Case

Hi

Easy question I hope. I have one cell (E11) on my spreadsheet, which I need
to be converted to Proper Case after input for all words in vba, for various
reasons I don't want to use the worksheet function for this. Can anyone tell
me the code I should use please?

Many Thanks
Martyn

Excel 2000, Windows 2003 server over Citrix PS4
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 360
Default Use of Proper Case

Range("e11").Value = Application.Proper(Range("e11").Value)

Cliff Edwards
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Use of Proper Case

Range("e11").Value = Application.Proper(Range("e11").Value)

Or, avoiding the call out to the worksheet function...

Range("E11").Value = StrConv(Range("E11").Value, vbProperCase)

Rick
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Use of Proper Case

Note to Martyn,

Otto posted a more complete answer as to how to implement what you want to
do; however, like Cliff, he also suggested calling out to the worksheet to
use its PROPER function... I would still suggest you use the StrConv
function statement call I posted in its place (but definitely use the
structure he posted).

Rick


"Rick Rothstein (MVP - VB)" wrote in
message ...
Range("e11").Value = Application.Proper(Range("e11").Value)


Or, avoiding the call out to the worksheet function...

Range("E11").Value = StrConv(Range("E11").Value, vbProperCase)

Rick


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 360
Default Use of Proper Case

I never did like that before...

Thanks!
Cliff Edwards



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Use of Proper Case

Sub properfy()
Set r = Range("E11")
s = r.Value
wrds = Split(s, " ")
For i = 0 To UBound(wrds)
v = wrds(i)
v = UCase(Left(v, 1)) & Right(v, Len(v) - 1)
wrds(i) = v
Next
r.Value = Join(wrds, " ")
End Sub



will convert:
now is the time for all good men
into:
Now Is The Time For All Good Men

--
Gary''s Student - gsnu200790


"WembleyBear" wrote:

Hi

Easy question I hope. I have one cell (E11) on my spreadsheet, which I need
to be converted to Proper Case after input for all words in vba, for various
reasons I don't want to use the worksheet function for this. Can anyone tell
me the code I should use please?

Many Thanks
Martyn

Excel 2000, Windows 2003 server over Citrix PS4

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default Use of Proper Case

You should use a Worksheet_Change event macro like the following. Note that
this macro must be placed in the sheet module of the sheet in question. To
access that module, right-click on the sheet tab, select View Code, and
paste this macro into that module. "X" out of the module to return to your
sheet. HTH Otto
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
If IsEmpty(Target.Value) Then Exit Sub
If Not Intersect(Target, Range("E11")) Is Nothing Then
Application.EnableEvents = False
Target.Value = Application.Proper(Target.Value)
Application.EnableEvents = True
End If
End Sub
"WembleyBear" wrote in message
...
Hi

Easy question I hope. I have one cell (E11) on my spreadsheet, which I
need
to be converted to Proper Case after input for all words in vba, for
various
reasons I don't want to use the worksheet function for this. Can anyone
tell
me the code I should use please?

Many Thanks
Martyn

Excel 2000, Windows 2003 server over Citrix PS4



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
Change Upper Case to Proper Case Michael Koerner Excel Programming 5 March 6th 08 02:52 PM
How do I change from upper case to proper case in excel 2002 CT Man[_2_] Excel Discussion (Misc queries) 8 January 8th 08 06:14 PM
excel'03 how to convert a column from upper case to proper case sharie palmer Excel Discussion (Misc queries) 1 January 30th 06 11:50 PM
Excel: How do I change all upper case ss to proper case? Moosieb Excel Worksheet Functions 3 January 13th 06 12:45 AM
Changing Upper case to Proper Case Mountain Excel Worksheet Functions 1 January 13th 05 10:37 PM


All times are GMT +1. The time now is 12:30 AM.

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

About Us

"It's about Microsoft Excel"