Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default How can I change the case of letters without using function ?

I am preparing a report in MS Excel with many sheets. I have typed it all
in capital letters. Now, I need to chage it to lower cases with the first
letter in capital. Pls tell me a tip to solve it.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default How can I change the case of letters without using function ?

Try something like this:

Sub test()

Dim sh As Worksheet
Dim rng As Range
Dim c As Range

For Each sh In ThisWorkbook.Worksheets
With sh
Set rng = Range(.Cells(1), _
.Cells(1).SpecialCells(xlLastCell))
For Each c In rng.Cells
If Not IsEmpty(c) Then
c.Value = _
Application.WorksheetFunction.Proper(c.Value)
End If
Next c
End With
Next sh

End Sub


RBS



"Rahim" wrote in message
...
I am preparing a report in MS Excel with many sheets. I have typed it all
in capital letters. Now, I need to chage it to lower cases with the first
letter in capital. Pls tell me a tip to solve it.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default How can I change the case of letters without using function ?

I would try something like that if I wanted all formulas on all sheets wiped
out.

For one sheet I would use this to change case and preserve formulas, if any
present.

Sub Proper_Case()
Dim rng As Range
Set rng = Nothing
On Error Resume Next
Set rng = Cells.SpecialCells(xlCellTypeConstants)
On Error GoTo 0
If rng Is Nothing Then
Else
rng.Formula = Application.Proper(rng.Formula)
End If
End Sub


Gord Dibben MS Excel MVP

On Sun, 17 Feb 2008 11:50:06 -0000, "RB Smissaert"
wrote:

Try something like this:

Sub test()

Dim sh As Worksheet
Dim rng As Range
Dim c As Range

For Each sh In ThisWorkbook.Worksheets
With sh
Set rng = Range(.Cells(1), _
.Cells(1).SpecialCells(xlLastCell))
For Each c In rng.Cells
If Not IsEmpty(c) Then
c.Value = _
Application.WorksheetFunction.Proper(c.Value)
End If
Next c
End With
Next sh

End Sub


RBS



"Rahim" wrote in message
...
I am preparing a report in MS Excel with many sheets. I have typed it all
in capital letters. Now, I need to chage it to lower cases with the first
letter in capital. Pls tell me a tip to solve it.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default How can I change the case of letters without using function ?

Sure, I hardly ever use formula's so tend to overlook that and thanks for
the correction.

RBS

"Gord Dibben" <gorddibbATshawDOTca wrote in message
...
I would try something like that if I wanted all formulas on all sheets
wiped
out.

For one sheet I would use this to change case and preserve formulas, if
any
present.

Sub Proper_Case()
Dim rng As Range
Set rng = Nothing
On Error Resume Next
Set rng = Cells.SpecialCells(xlCellTypeConstants)
On Error GoTo 0
If rng Is Nothing Then
Else
rng.Formula = Application.Proper(rng.Formula)
End If
End Sub


Gord Dibben MS Excel MVP

On Sun, 17 Feb 2008 11:50:06 -0000, "RB Smissaert"
wrote:

Try something like this:

Sub test()

Dim sh As Worksheet
Dim rng As Range
Dim c As Range

For Each sh In ThisWorkbook.Worksheets
With sh
Set rng = Range(.Cells(1), _
.Cells(1).SpecialCells(xlLastCell))
For Each c In rng.Cells
If Not IsEmpty(c) Then
c.Value = _
Application.WorksheetFunction.Proper(c.Value)
End If
Next c
End With
Next sh

End Sub


RBS



"Rahim" wrote in message
...
I am preparing a report in MS Excel with many sheets. I have typed it
all
in capital letters. Now, I need to chage it to lower cases with the
first
letter in capital. Pls tell me a tip to solve it.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default How can I change the case of letters without using function ?

I view it as "just in case" code.

No pun intended.

Gord

On Sun, 17 Feb 2008 18:14:38 -0000, "RB Smissaert"
wrote:

Sure, I hardly ever use formula's so tend to overlook that and thanks for
the correction.

RBS

"Gord Dibben" <gorddibbATshawDOTca wrote in message
.. .
I would try something like that if I wanted all formulas on all sheets
wiped
out.

For one sheet I would use this to change case and preserve formulas, if
any
present.

Sub Proper_Case()
Dim rng As Range
Set rng = Nothing
On Error Resume Next
Set rng = Cells.SpecialCells(xlCellTypeConstants)
On Error GoTo 0
If rng Is Nothing Then
Else
rng.Formula = Application.Proper(rng.Formula)
End If
End Sub


Gord Dibben MS Excel MVP

On Sun, 17 Feb 2008 11:50:06 -0000, "RB Smissaert"
wrote:

Try something like this:

Sub test()

Dim sh As Worksheet
Dim rng As Range
Dim c As Range

For Each sh In ThisWorkbook.Worksheets
With sh
Set rng = Range(.Cells(1), _
.Cells(1).SpecialCells(xlLastCell))
For Each c In rng.Cells
If Not IsEmpty(c) Then
c.Value = _
Application.WorksheetFunction.Proper(c.Value)
End If
Next c
End With
Next sh

End Sub


RBS



"Rahim" wrote in message
...
I am preparing a report in MS Excel with many sheets. I have typed it
all
in capital letters. Now, I need to chage it to lower cases with the
first
letter in capital. Pls tell me a tip to solve it.





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,231
Default How can I change the case of letters without using function ?

Gord Dibben <gorddibbATshawDOTca wrote...
....
For one sheet I would use this to change case and preserve formulas,
if any present.

Sub Proper_Case()
Dim rng As Range
Set rng = Nothing
On Error Resume Next
Set rng = Cells.SpecialCells(xlCellTypeConstants)
On Error GoTo 0
If rng Is Nothing Then
Else
rng.Formula = Application.Proper(rng.Formula)
End If
End Sub

....

Random indentation?

This macro will replace all cells containing text constants with the
proper case value of the first cell in the range SpecialCells returns.
For example, if C1 contained foo and A3 contained bar, running this
macro would produce Foo in BOTH C1 AND A3. Unlikely that's what the OP
wants.

Better to stick with iterating through individual cells within the
selected worksheets.


Sub foo()
Dim c As Range, rng As Range, ws As Worksheet

For Each ws In ActiveWindow.SelectedSheets
On Error Resume Next
Set rng = ws.UsedRange.SpecialCells(xlCellTypeConstants)

If Err.Number = 0 Then
For Each c In rng
c.Formula = Application.WorksheetFunction.Proper(c.Formula)
Next c

Else
Err.Clear

End If

Next ws

End Sub
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 947
Default How can I change the case of letters without using function ?

Just to mention another option. Proper can't evaluate multiple areas, but
it can do a single "Area."

Sub Proper_Case()
Dim rng As Range
Dim Grp As Range

On Error Resume Next
Set rng = Cells.SpecialCells(xlCellTypeConstants)
On Error GoTo 0

If Not rng Is Nothing Then
For Each Grp In rng.Areas
Grp.Value = Application.Proper(Grp.Value)
Next Grp
Else
'Do Nothing
End If
End Sub

--
Dana DeLouis


"Harlan Grove" wrote in message
...
Gord Dibben <gorddibbATshawDOTca wrote...
...
For one sheet I would use this to change case and preserve formulas,
if any present.

Sub Proper_Case()
Dim rng As Range
Set rng = Nothing
On Error Resume Next
Set rng = Cells.SpecialCells(xlCellTypeConstants)
On Error GoTo 0
If rng Is Nothing Then
Else
rng.Formula = Application.Proper(rng.Formula)
End If
End Sub

...

Random indentation?

This macro will replace all cells containing text constants with the
proper case value of the first cell in the range SpecialCells returns.
For example, if C1 contained foo and A3 contained bar, running this
macro would produce Foo in BOTH C1 AND A3. Unlikely that's what the OP
wants.

Better to stick with iterating through individual cells within the
selected worksheets.


Sub foo()
Dim c As Range, rng As Range, ws As Worksheet

For Each ws In ActiveWindow.SelectedSheets
On Error Resume Next
Set rng = ws.UsedRange.SpecialCells(xlCellTypeConstants)

If Err.Number = 0 Then
For Each c In rng
c.Formula = Application.WorksheetFunction.Proper(c.Formula)
Next c

Else
Err.Clear

End If

Next ws

End Sub


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default How can I change the case of letters without using function ?

Hi,

Well you don't give too much detail but this may work for you

=proper(a1)

where A1 is the word to convert. If there are multiple words in A1 it will
capitalise the first letter of each word which may not be what you want.

Mike

"Rahim" wrote:

I am preparing a report in MS Excel with many sheets. I have typed it all
in capital letters. Now, I need to chage it to lower cases with the first
letter in capital. Pls tell me a tip to solve it.

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default How can I change the case of letters without using function ?

If, as Mike speculates, you only want the first word capitalized search this
group for "sentence case".

Regards,
Peter T


"Mike H" wrote in message
...
Hi,

Well you don't give too much detail but this may work for you

=proper(a1)

where A1 is the word to convert. If there are multiple words in A1 it will
capitalise the first letter of each word which may not be what you want.

Mike

"Rahim" wrote:

I am preparing a report in MS Excel with many sheets. I have typed it

all
in capital letters. Now, I need to chage it to lower cases with the

first
letter in capital. Pls tell me a tip to solve it.



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
can I change the cap letters of student names to lower case user Excel Discussion (Misc queries) 2 May 28th 10 01:42 AM
Can I change case automatically without using PROPER function? John Excel Discussion (Misc queries) 4 October 23rd 08 10:56 AM
How to change lower to upper case letters? Sigi Rindler Excel Discussion (Misc queries) 1 November 25th 06 09:33 AM
ADD Change Case function from Word to Excel Carolyn E Excel Worksheet Functions 2 August 7th 06 08:03 PM
Change Function Name Text to Upper Case Vyyk Drago Excel Programming 0 September 2nd 03 02:47 PM


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