I am using Excel 2010.
In a spreadsheet I have to change text in various places to proper case. I have some exceptions such as the word 'of'. All this works.
Is there any way for me to capitalize words around parentheses. Any word wrapped in parentheses is a government acronym and should be capitalized. Currently after running this macro, (FDA) comes out as (Fda).
Thank you for your help.
--Perry
Sub mcrzzProperCaseTEST2()
'Proper Case selected cells with Exceptions for Prepositions
'Subordinate conjuctions will be capitalized -- because, as, who, if, that, what, why, that, when, where
'Following will be in lower case:
a, an, the, and, but, for, nor, yet, by, with, on, to, of, at, around
Dim txtString As String
Dim RngCell As Range
'Do not convert exceptions in cells selected to proper case
For Each RngCell In Selection
txtString = Application.WorksheetFunction.Proper(RngCell.Value)
txtString = Application.Substitute(txtString, " Of ", " of ")
RngCell.Value = txtString
Next RngCell
'Capitalize words within parentheses
End Sub
Bookmarks