|
Mettre en MAJUSCULE le nom et la première lettre du prénom et minuscule pour le reste du prénom. DUPONT Pierre voici une fonction qui fait cela, et qui peut être appelée directement dans une feuille de calcul de cette manière : =NOMPrenom(D3)
'http://www.excel-downloads.com/html/French/forum/messages/1_94703_94703.htm ' Function NOMPrenom$(ByVal NP$) 'Ti Dim Tabl Tabl = Split(StrConv(NP, vbProperCase)) If UBound(Tabl) >= 0 Then Tabl(0) = UCase(Tabl(0)) NOMPrenom = Join(Tabl) End Function
Dupont PIERRE
Function PrenomNOM$(ByVal NP$) 'Ti Dim Tabl Tabl = Split(StrConv(NP, vbProperCase)) If UBound(Tabl) >= 1 Then Tabl(1) = UCase(Tabl(1)) PrenomNOM = Join(Tabl) End Function
La même chose avec des fonctions de chaînes plus classiques notamment pour Excel 97
Function NOMPrenom$(ByVal NP$) 'Ti Dim Pos& NOMPrenom = UCase(NP) Pos = InStr(1, NOMPrenom, " ") If Pos > 0 Then NOMPrenom = Left(NOMPrenom, Pos - 1) & StrConv(Mid(NOMPrenom, Pos), vbProperCase) End Function
Function PrenomNOM$(ByVal NP$) 'Ti Dim Pos& PrenomNOM = StrConv(NP, vbProperCase) Pos = InStr(1, PrenomNOM, " ") If Pos > 0 Then PrenomNOM = Left(PrenomNOM, Pos - 1) & UCase(Mid(PrenomNOM, Pos)) End Function
Date de création : 24/05/2005 - 19:01
Dernière modification : 25/05/2005 - 23:03
Catégorie : Feuille
Page lue 3859 fois
Prévisualiser la page
Imprimer la page
|
|