Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 138
Default Change Text Case

I want to be able to run a Macro that chnages all the cell contents from
UPPERCASE to Titlecase. I know hwo to do it in Word but can this be done in
Excel?

Tia


Jonathan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Change Text Case

Hi Johnathan,

Try:

'===============
Sub MakeProperCase()
Dim rCell As Range
On Error Resume Next
For Each rCell In selection.Cells
If Not rCell.HasFormula Then
rCell.value = Application.Proper(rCell.value)
Else
ActiveCell.Formula = Application.Proper(ActiveCell.Formula)
End If
Next myCell
End Sub
'<<===============

If this is a frequent requirement, you might wish to add a toolbar button
and assign the macro to the new button.

---
Regards,
Norman



"Jonathan" wrote in message
...
I want to be able to run a Macro that chnages all the cell contents from
UPPERCASE to Titlecase. I know hwo to do it in Word but can this be done
in
Excel?

Tia


Jonathan



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 138
Default Change Text Case

Hi Norman,

Thanks for the code it works but it is taking for ever to run becuase I have
a large amount of data, rather than using a loop is there a way I can acheive
the same results but using a selection of columns i.e. A:G only?

"Norman Jones" wrote:

Hi Johnathan,

Try:

'===============
Sub MakeProperCase()
Dim rCell As Range
On Error Resume Next
For Each rCell In selection.Cells
If Not rCell.HasFormula Then
rCell.value = Application.Proper(rCell.value)
Else
ActiveCell.Formula = Application.Proper(ActiveCell.Formula)
End If
Next myCell
End Sub
'<<===============

If this is a frequent requirement, you might wish to add a toolbar button
and assign the macro to the new button.

---
Regards,
Norman



"Jonathan" wrote in message
...
I want to be able to run a Macro that chnages all the cell contents from
UPPERCASE to Titlecase. I know hwo to do it in Word but can this be done
in
Excel?

Tia


Jonathan




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Change Text Case

Hi Jonathan,

Try:
'====================
Public Sub MakeProperCase()
Sub MakeProperCase()
Dim ws As Worksheet
Dim rng As Range
Dim rCell As Range

Set ws = ActiveSheet

On Error Resume Next
Set rng = Columns("A:G").SpecialCells(xlCellTypeConstants, 2)
On Error GoTo 0

If Not rng Is Nothing Then

Application.ScreenUpdating = False

For Each rCell In rng.Cells
rCell.Value = Application.Proper(rCell.Value)
Next rCell

Application.ScreenUpdating = True

End If

End Sub
'<<====================

---
Regards,
Norman



"Jonathan" wrote in message
...
Hi Norman,

Thanks for the code it works but it is taking for ever to run becuase I
have
a large amount of data, rather than using a loop is there a way I can
acheive
the same results but using a selection of columns i.e. A:G only?

"Norman Jones" wrote:

Hi Johnathan,

Try:

'===============
Sub MakeProperCase()
Dim rCell As Range
On Error Resume Next
For Each rCell In selection.Cells
If Not rCell.HasFormula Then
rCell.value = Application.Proper(rCell.value)
Else
ActiveCell.Formula = Application.Proper(ActiveCell.Formula)
End If
Next myCell
End Sub
'<<===============

If this is a frequent requirement, you might wish to add a toolbar button
and assign the macro to the new button.

---
Regards,
Norman



"Jonathan" wrote in message
...
I want to be able to run a Macro that chnages all the cell contents from
UPPERCASE to Titlecase. I know hwo to do it in Word but can this be
done
in
Excel?

Tia


Jonathan






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 the text from lower case to upper case in an Excel work boo dave01968 Excel Discussion (Misc queries) 2 December 9th 05 09:09 AM
Change case of text Ferd Excel Discussion (Misc queries) 1 December 7th 05 09:00 AM
Change Text Case Lilbit Excel Worksheet Functions 3 October 9th 05 05:58 PM
How do I change the case of text date formats morph the dates/chang case New Users to Excel 2 April 18th 05 10:15 PM
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:40 PM.

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"