a macro to PROPER text

P

pcor

I would like a macro that would set the "proper" format for the cell selected.
Thanks
 
R

Roger Govier

Hi

Sub SetProper()

Dim c As Range
For Each c In Selection
c.Value = WorksheetFunction.Proper(c.Value)
Next

End Sub
 
P

pcor

Thanks. That worked very well. I had thought that to use this macro I could
replace "Proper" with "Upper" or "Lower" but that did not work. So How do I
change your macro to change the cell to either UPPER or LOWER format.
Thanks
Ian M
 
S

Shane Devenshire

Hi,

For Proper you need to call the worksheet function but for upper and lower
you must use UCase and PCase

c.Value = UCase(c.Value)
 
P

pcor

Many thanks.Worked very well


Shane Devenshire said:
Hi,

For Proper you need to call the worksheet function but for upper and lower
you must use UCase and PCase

c.Value = UCase(c.Value)

--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top