Macro - modification intitulé

Bonjour à tous,

Sur le fichier joint je voudrais pouvoir par le biais d'une macro renommer l'intitulé de mes colonnes :

- Si le code client en colonne E = C000 alors le nom du client en colonne F serait "Divers".

- Si le commercial en colonne D = GIMEL alors on le remplace par AGE

Merci

4client-macro.xlsx (150.87 Ko)

d'avance,

Bonjour

Vous pouvez essayer ce code

Sub test()
Dim cel As Range

For Each cel In ActiveSheet.ListObjects("C.Affaire").ListColumns(5).DataBodyRange
    If cel.Value = "C000" Then cel.Offset(0, 1) = "Divers"
    If cel.Offset(0, -1).Value = "GIMEL" Then cel.Offset(0, -1).Value = "AGE"
Next cel
End Sub

Fichier à enregistrer au format XLSM bien entendu

si ok -->

Cordialement

Merci Dan,

Cela fonctionne très bien !!!

Rechercher des sujets similaires à "macro modification intitule"