I am trying to correct the case of first letters of French proper names in multiple calls of Excel sheets using VBA. I have data entered by many different people, some in lowercase, some in upper case, some mixed, etc etc.
I am looking for a better function than the PROPER()
function. Though using PROPER()
in the formula of a cell gives the correct result for most names (by setting the first letter in words to uppercase and the rest to lowercase) it gives the wrong results when names contain prepositions.
In French, simple names normally start with uppercase, but prepositions usually with lowercase. This is what I want to achieve.
Examples of correct French case of proper names:
- Jean de Villeneuve
- Domaine de la Romanée-Conti
- Cellier des Rois
The result of the PROPER()
function on these is wrong: :
- Jean De Villeneuve
- Domaine De La Romanée-Conti
- Cellier Des Rois
Are there any easy ways to use VBA to apply the correct French case to proper names?
If possible, I would like the very first letter of a cell to be uppercase for all words.
You need a custom function for this, because as you noted
PROPER
only capitalizes the first letter each word in a given string.Add a standard module (e.g.
Module1
) to your VBA project, and implement a user-defined function in it:And now you can do
=ProperFR("Domaine De La Romanée-Conti")
and getDomaine de la Romanée-Conti
as an output.