Maybe something likeCode:Sub rhmkrmi() With Selection .Value = Evaluate("if({1},proper(" & .Address & "),"""")") End With End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.CountLarge > 1 Then Exit Sub
If Not Intersect(Target, Range("A1:A10")) Is Nothing Then
Application.EnableEvents = False
Target.Value = Application.Proper(Target.Value)
Application.EnableEvents = True
End If
End Sub
I'll assume "dynamic" means whenever data is input to any cell in column A (if it means something else, post again).Thanks a lot.
It works fine.
How can I make the range dynamic, like, A$1:A10?
Also, is there a way to make words like "of" and "the" always lower case in this macro?
Private Sub Worksheet_Change(ByVal Target As Range)
Dim ray, i%
If Target.CountLarge > 1 Then Exit Sub
If Target.Column = 1 Then
ray = Split(Application.Proper(Target), " ")
For i = 1 To UBound(ray)
If ray(i) = "Of" Or ray(i) = "The" Then ray(i) = LCase(ray(i))
Next
Application.EnableEvents = False
Target = Join(ray, " ")
Application.EnableEvents = True
End If
End Sub