Reputation: 63
I would like to proper case a range and replace the existing text with the first letter of each word capitalized for consistent formatting in our database.
After some research, I noticed StrConv
can be used with vbProperCase
although I'm not sure I understand quite how it works:
Dim cityNames As Range
Set cityNames = Columns("A:B")
format.Value = StrConv(cityNames.Value, vbProperCase)
Upvotes: 0
Views: 365
Reputation: 166146
You can use the PROPER() worksheet function
Sub tester()
Dim ws
Set ws = ActiveSheet
With Application.Intersect(ws.Range("A:B"), ws.UsedRange)
.Value = .Parent.Evaluate("=PROPER(" & .Address & ")")
End With
End Sub
Upvotes: 3