vba uppercase Each word in a cell

bluefeather8989

Active Member
Joined
Nov 20, 2009
Messages
325
Office Version
  1. 365
Platform
  1. Windows
Need a simple vba to uppercase first letter of Each word in cell D3 when cell change.
Example:
john smith to John Smith
tom hanks to Tom Hanks
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Strconv([d3],vbpropercase)
 
Upvote 0
Strconv([d3],vbpropercase)
I get a syntax error
i have this code but it changes every letter to uppercase
VBA Code:
    Application.EnableEvents = False
    If Not Intersect(Target, Range("D3")) Is Nothing Then
        Target = UCase(Target)
    End If
    Application.EnableEvents = True
 
Upvote 0
How did you use it? It’s just the function, not the complete code you need
 
Upvote 0
Target = strconv(Target, vbpropercase)
 
Upvote 0
Solution
And you don’t need intersect for just one cell

If target.address(0,0) ="D3" then
 
Upvote 0
Target = strconv(Target, vbpropercase)
Thanks works great.
Rich (BB code):
    Application.EnableEvents = False
    If Target.Address(0, 0) = "D3" Then
        Target = StrConv(Target, vbProperCase)
    End If
    Application.EnableEvents = True
 
Upvote 0

Forum statistics

Threads
1,215,073
Messages
6,122,975
Members
449,095
Latest member
Mr Hughes

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top