Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro to Change to Title Case in Excel??? 2

Status
Not open for further replies.

SnakeCharmer

Technical User
Mar 17, 2003
9
GB
I have the following code to change all cells on a worksheet to uppercase:

******

Sub MakeUppercase()
For Each cell In ActiveSheet.UsedRange
If cell.HasFormula = False Then
cell.Value = UCase(cell.Value)
End If
Next cell
End Sub

******

I can change the UCase to an LCase to convert to lowercase, but how can I convert to title case?

Cheers!
 
Sub MakeUppercase()
For Each cell In ActiveSheet.UsedRange
If cell.HasFormula = False Then
cell.Value = Application.WorksheetFunction.Proper(cell.Value)
End If
Next cell
End Sub
 
ETID, I'm a little intrigued as to why you need to check that the cell doesn't have a formula a formula first before transforming the text?

Also, in my book,
Code:
cell[code] is a little too close to [code]cells
, I'd change it to eg
Code:
cll
, but I guess that's a stylistic thing.

 
I only looked at the problem as outlined by the question.

So I only modified that part of snakecharmer's code as posted.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top