Proper Case

  • Thread starter Thread starter Scapa
  • Start date Start date
S

Scapa

Have searched the forum but the answer only covers one cell. I have a
template that covers A1:H44 and I need the lot in proper case as I type
in or after hitting the enter. Is there a function/formula to cover?
If not, is there a small programme that does the job?
Thanking every1 in advance.
Scapa
 
Just highlight the range to change and use this

Sub TextConvert() 'Better than mine
'By Ivan F Moala
Dim ocell As Range
Dim Ans As String

Ans = Application.InputBox("Type in Letter" & vbCr & _
"(L)owercase, (U)ppercase, (S)entence, (T)itles ")

If Ans = "" Then Exit Sub

For Each ocell In Selection '.SpecialCells(xlCellTypeConstants, 2)
Select Case UCase(Ans)
Case "L": ocell = LCase(ocell.Text)
Case "U": ocell = UCase(ocell.Text)
Case "S": ocell = UCase(Left(ocell.Text, 1)) & _
LCase(Right(ocell.Text, Len(ocell.Text) - 1))
Case "T": ocell = Application.WorksheetFunction.Proper(ocell.Text)
End Select
Next

End Sub
 
Hi Don

Thanks for your quick response. Can't seem to get it to work.
Have typed it in as you've typed it but nothing happens.
Any ideas what I'm doing wrong.
Thanks once again
Scapa
 
You don't type it in. You copy/paste into a macro module. If you haven't
done this the easiest way for you would be to right click on the excel icon
in the upper left next to FILE>view code>paste there. Then, from the
workbook just use alt F8 and run it, or assign to a button or shape.
 
Thanks Don. Excuse ignorance. Have used the one that JE suggested and
did just that and works perfectly. Once again thanks to the both of
you for your help. Scapa :)
 
Back
Top