#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Proper case

Hi All,
Is there an equivalent in VB for woorksheet function Proper
(). Also, Is there an equvalent of Word's sentence case
functionality in Excel and VB. Thanks for your comments

Regards
Saju
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default Proper case

Saju, try this, if you put it in your personal workbook it will be available
to all you workbooks

Sub TextConvert()
'By Ivan F Moala
'will change the text that you have selected,
'if no text is selected it will change the whole sheet
Dim ocell As Range
Dim Ans As String

Ans = Application.InputBox("Type in Letter" & vbCr & _
"(L)owercase, (U)ppercase, (S)entence, (T)itles ")

If Ans = "" Then Exit Sub

For Each ocell In Selection.SpecialCells(xlCellTypeConstants, 2)
Select Case UCase(Ans)
Case "L": ocell = LCase(ocell.Text)
Case "U": ocell = UCase(ocell.Text)
Case "S": ocell = UCase(Left(ocell.Text, 1)) & _
LCase(Right(ocell.Text, Len(ocell.Text) - 1))
Case "T": ocell = Application.WorksheetFunction.Proper(ocell.Text)
End Select
Next

End Sub

--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 97 & 2000
** remove news from my email address to reply by email **

"Saju" wrote in message
...
Hi All,
Is there an equivalent in VB for woorksheet function Proper
(). Also, Is there an equvalent of Word's sentence case
functionality in Excel and VB. Thanks for your comments

Regards
Saju



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Proper case

Paul & Frank,

Thank you vary much for your help. This is very useful.

Regards

Saju

-----Original Message-----
Saju, try this, if you put it in your personal workbook

it will be available
to all you workbooks

Sub TextConvert()
'By Ivan F Moala
'will change the text that you have selected,
'if no text is selected it will change the whole sheet
Dim ocell As Range
Dim Ans As String

Ans = Application.InputBox("Type in Letter" & vbCr & _
"(L)owercase, (U)ppercase, (S)entence, (T)itles ")

If Ans = "" Then Exit Sub

For Each ocell In Selection.SpecialCells

(xlCellTypeConstants, 2)
Select Case UCase(Ans)
Case "L": ocell = LCase(ocell.Text)
Case "U": ocell = UCase(ocell.Text)
Case "S": ocell = UCase(Left(ocell.Text, 1)) & _
LCase(Right(ocell.Text, Len(ocell.Text) - 1))
Case "T": ocell = Application.WorksheetFunction.Proper

(ocell.Text)
End Select
Next

End Sub

--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can

benefit from it
Feedback on answers is always appreciated!
Using Excel 97 & 2000
** remove news from my email address to reply by email **

"Saju" wrote in

message
...
Hi All,
Is there an equivalent in VB for woorksheet function

Proper
(). Also, Is there an equvalent of Word's sentence case
functionality in Excel and VB. Thanks for your comments

Regards
Saju



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Proper case

Hi
you may use
application.worksheetfunction.Proper(...)

--
Regards
Frank Kabel
Frankfurt, Germany


Saju wrote:
Hi All,
Is there an equivalent in VB for woorksheet function Proper
(). Also, Is there an equvalent of Word's sentence case
functionality in Excel and VB. Thanks for your comments

Regards
Saju

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Proper case

Using the StrConv keeps you in VB. Not that there's anything wrong with
jumping over to Excel.

--
Jim Rech
Excel MVP

"Frank Kabel" wrote in message
...
| Hi
| you may use
| application.worksheetfunction.Proper(...)
|
| --
| Regards
| Frank Kabel
| Frankfurt, Germany
|
|
| Saju wrote:
| Hi All,
| Is there an equivalent in VB for woorksheet function Proper
| (). Also, Is there an equvalent of Word's sentence case
| functionality in Excel and VB. Thanks for your comments
|
| Regards
| Saju




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Proper case

StrConv(string, conversion)

for conversion use

vbProperCase


sStr = StrConv(sStr, vbProperCase)

I have no Idea waht Word's sentence case functionality is, but try using
strconv with your sentence.

--
Regards,
Tom Ogilvy


"Saju" wrote in message
...
Hi All,
Is there an equivalent in VB for woorksheet function Proper
(). Also, Is there an equvalent of Word's sentence case
functionality in Excel and VB. Thanks for your comments

Regards
Saju



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Proper case

Hi Saju,

You could use the Proper worksheet function as Frank says, but if you want
an application independent VBA function, this is what I use

'---------------------------------------------------------------------
Public Function Capitalize(Name As String), _
Optional Delim As String = " "
'---------------------------------------------------------------------
Dim aParts
Dim i As Long

aParts = Split(LCase(RemoveMultipleSpaces(Name)), Delim)
For i = LBound(aParts, 1) To UBound(aParts, 1)
aParts(i) = UCase(Left(aParts(i), 1)) & _
Right(aParts(i), Len(aParts(i)) - 1)
Next i
Capitalize = Join(aParts, Delim)

End Function



--

HTH

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

"Saju" wrote in message
...
Hi All,
Is there an equivalent in VB for woorksheet function Proper
(). Also, Is there an equvalent of Word's sentence case
functionality in Excel and VB. Thanks for your comments

Regards
Saju



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
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
Proper Case Roger Bell Excel Discussion (Misc queries) 14 June 2nd 07 11:04 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 02:34 AM.

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"