Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Cecile
 
Posts: n/a
Default Changing from upper case

Hi all, I have a spreadsheet (1000+ lines) which has a lot
of upper cases. How can I change the text to sentence case?
I tried looking at the PROPER function, but it doesn't
seem to do what I want.
Thanks in advance,
Cecile.
  #2   Report Post  
Norman Jones
 
Posts: n/a
Default

Hi Cecile,

Try:

Sub Tester()
Dim rng As Range
Dim rCell As Range

Set rng = ActiveSheet.UsedRange

For Each rCell In rng.SpecialCells(xlCellTypeConstants, 2)
With rCell
.Value = Application.Proper(.Value)
End With
Next
End Sub

If you are unfamiliar with macros, see David McRitchie's Getting Started
with Macros and User Defined Functions notes at:

http://www.mvps.org/dmcritchie/excel/getstarted.htm


---
Regards,
Norman



"Cecile" wrote in message
...
Hi all, I have a spreadsheet (1000+ lines) which has a lot
of upper cases. How can I change the text to sentence case?
I tried looking at the PROPER function, but it doesn't
seem to do what I want.
Thanks in advance,
Cecile.



  #3   Report Post  
Myrna Larson
 
Posts: n/a
Default

If you mean that you want only the 1st letter of the 1st word capitalized, you
can use this formula in another column:

=UPPER(LEFT(A1,1))&LOWER(MID(A1,2,255))

Copy down as far as needed, then Edit/Copy the column with the formulas and
Edit/Paste Special and select the Values option to replace the formulas with
the literal text. Then you can delete the column with the original text.

On Sun, 12 Dec 2004 18:04:01 -0800, "Cecile"
wrote:

Hi all, I have a spreadsheet (1000+ lines) which has a lot
of upper cases. How can I change the text to sentence case?
I tried looking at the PROPER function, but it doesn't
seem to do what I want.
Thanks in advance,
Cecile.


  #4   Report Post  
Gord Dibben
 
Posts: n/a
Default

Cecile

Would you be interested in using a macro?

Either for Sentence Case or Proper Case....your choice or both.

This is sentence case. First letter upper after each period. Like this.

This Is Proper Case. All Words Upper First Letter.


Gord Dibben Excel MVP

On Sun, 12 Dec 2004 18:04:01 -0800, "Cecile"
wrote:

Hi all, I have a spreadsheet (1000+ lines) which has a lot
of upper cases. How can I change the text to sentence case?
I tried looking at the PROPER function, but it doesn't
seem to do what I want.
Thanks in advance,
Cecile.


  #5   Report Post  
Southcecile
 
Posts: n/a
Default

Hi all, thanks for your replies, I will definitely give them a try tomorrow.

Yes Gord I'd be interested in using a macro, sentence case is what I'm after.

Cheers,

Cecile.

"Cecile" wrote:

Hi all, I have a spreadsheet (1000+ lines) which has a lot
of upper cases. How can I change the text to sentence case?
I tried looking at the PROPER function, but it doesn't
seem to do what I want.
Thanks in advance,
Cecile.



  #6   Report Post  
Gord Dibben
 
Posts: n/a
Default

Cecile

A UDF and a macro that references it.............

Function CapFirst(ByVal str As String) As String
Dim aRegExp As Object, aMatch As Object, allMatches As Object
Set aRegExp = CreateObject("vbscript.regexp")
aRegExp.Pattern = "^[a-z]|\.( )*[a-z]"
aRegExp.Global = True
Set allMatches = aRegExp.Execute(str)
For Each aMatch In allMatches
With aMatch
Mid(str, .firstindex + 1 + .length - 1, 1) = _
UCase(Mid(str, .firstindex + 1 + .length - 1, 1))
End With
Next aMatch
CapFirst = str
End Function

Sub Sentence_Case()
Dim myStr As String
Dim cel As Range
For Each cel In Selection
If cel.HasFormula = True Then Exit Sub
myStr = cel.Value
cel.Value = "=CapFirst(" & """" & myStr & """" & ")"
cel.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlValues
Application.CutCopyMode = False
Next cel
End Sub


Gord

On Tue, 14 Dec 2004 02:53:02 -0800, "Southcecile"
wrote:

Hi all, thanks for your replies, I will definitely give them a try tomorrow.

Yes Gord I'd be interested in using a macro, sentence case is what I'm after.

Cheers,

Cecile.

"Cecile" wrote:

Hi all, I have a spreadsheet (1000+ lines) which has a lot
of upper cases. How can I change the text to sentence case?
I tried looking at the PROPER function, but it doesn't
seem to do what I want.
Thanks in advance,
Cecile.


  #7   Report Post  
Cecile
 
Posts: n/a
Default

Thank you Gord,

I'll give it a go!

Cheers,

Cecile.

-----Original Message-----
Cecile

A UDF and a macro that references it.............

Function CapFirst(ByVal str As String) As String
Dim aRegExp As Object, aMatch As Object, allMatches As

Object
Set aRegExp = CreateObject("vbscript.regexp")
aRegExp.Pattern = "^[a-z]|\.( )*[a-z]"
aRegExp.Global = True
Set allMatches = aRegExp.Execute(str)
For Each aMatch In allMatches
With aMatch
Mid(str, .firstindex + 1 + .length - 1, 1) = _
UCase(Mid(str, .firstindex + 1 + .length - 1,

1))
End With
Next aMatch
CapFirst = str
End Function

Sub Sentence_Case()
Dim myStr As String
Dim cel As Range
For Each cel In Selection
If cel.HasFormula = True Then Exit Sub
myStr = cel.Value
cel.Value = "=CapFirst(" & """" & myStr & """"

& ")"
cel.Select
Selection.Copy
Selection.PasteSpecial Paste:=xlValues
Application.CutCopyMode = False
Next cel
End Sub


Gord

On Tue, 14 Dec 2004 02:53:02 -0800, "Southcecile"
wrote:

Hi all, thanks for your replies, I will definitely give

them a try tomorrow.

Yes Gord I'd be interested in using a macro, sentence

case is what I'm after.

Cheers,

Cecile.

"Cecile" wrote:

Hi all, I have a spreadsheet (1000+ lines) which has a

lot
of upper cases. How can I change the text to sentence

case?
I tried looking at the PROPER function, but it doesn't
seem to do what I want.
Thanks in advance,
Cecile.


.

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
displaying ranges iart Excel Discussion (Misc queries) 15 September 10th 05 02:02 PM
Identifying the Active Fill Color Steve Conary Excel Discussion (Misc queries) 3 December 9th 04 04:45 AM
changing lower case to upper case T. Campbell Excel Discussion (Misc queries) 1 December 8th 04 05:37 PM
change typed text to upper case CT Cameron Excel Discussion (Misc queries) 2 November 30th 04 01:07 AM
How do I change existing text from lower case to upper case CT Cameron Excel Discussion (Misc queries) 2 November 30th 04 01:07 AM


All times are GMT +1. The time now is 02:32 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"