Sure thing
Sub Caps()
Range(Cells(1, 1), Selection.SpecialCells(xlLastCell)).Select
For Each cell In Selection
cell.Value = UCase(Left(cell.Value, 1)) & LCase(Mid(cell.Value, 2))
Next cell
End Sub
Sub Lowcaps()
Range(Cells(1, 1), Selection.SpecialCells(xlLastCell)).Select
For Each cell In Selection
cell.Value = LCase(cell.Value)
Next cell
End Sub
Best wishes Harald
Help --> Index --> PROPER Worksheet Function
VBA Example:
Sub Proper_Case()
For Each Cell In Selection
Cell = Application.Proper(Cell)
Next
End Sub
see http://members.aol.com/rexx03/excel/proper.htm
also Re: Change Case, a reply posting by Bill Manville. Bill's code will also
handle cells with formulas by enclosing the formula rather than simply changing
data.
http://www.dejanews.com/getdoc.xp?AN=382221704
Not the above refers to a specific article in DejaNews.
HTH,
David McRitchie
My Excel Pages: http://members.aol.com/dmcritchie/excel/excel.htm
It is interesting that either of the following will work, I have a lot to
learn on VB objects. Well actually I guess there was nothing to say what
cell actually was so it was probably just an integer and nothing to do with
the spreadsheet.
Sub Proper_Case()
For Each cell In Selection
cell.value = Application.Proper(cell)
Next
End Sub
--or the addition of Dim statement--
Sub Proper_Case()
Dim cell As Range
For Each cell In Selection
cell = Application.Proper(cell)
Next
End Sub
Lennart, Thanks for pointing this out in your email question. The code I
actually use wasn't what I copied from my web page <embarrassment>. I have
corrected my web page.
David McRitchie
My Excel Pages: http://members.aol.com/dmcritchie/excel/excel.htm
Corrected Page: http://members.aol.com/rexx03/excel/proper.htm
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
UCase(cell)
LCase(cell)
Application.Proper(cell)
Or, if you want a worksheet solution:
=UPPER(cell)
=LOWER(cell)
=PROPER(cell)
HTH,
Nick
--
Nick Manton
Chemistry & Chemical Engineering Labs.
SRI International, Menlo Park, CA
ni...@sri.com
Lennart Back wrote in message
<26WC1.2783$S45.4...@nntpserver.swip.net>...