Bonjour,
J'explique ma situation.
J'essaie d'automatiser la création et l'édition des Fiches techniques de nos produits...
J'ai donc le classeur en Pj, avec 3 onglets:
_liste produit à partir de laquelle je souhaite faire une macro pur éditer au format word les ft(je m'en suis pas encore occuper^^)
_une base de données étiquettes avec les listes d'ingrédients;
_et le modèle Ft , feuille sur laquelle je bosse en ce moment....et je galère!!!
J'ai réussi à faire ce code en m'inspirant un peu partout.
Seulement, il me faut lister tout les allergènes dans les 3 langues, je vais avoir un code assez lourds....mais ça peut encore le faire.
Par contre, chaque allergène n'est mis en gras qu'une fois....et je voudrai qu'ils tous soient mis en gras (si le mot lait est 3 fois dans la cellule=> 3 fois en gras)
Voici mon code (relié au bouton "allergène")
Après, si vous avez une solution plus simple, comme utiliser la liste en colonne A....je suis preneur...je demande qu'à apprendre.
Merci par avance de votre aide!!!!!!
Cordialement.
J'explique ma situation.
J'essaie d'automatiser la création et l'édition des Fiches techniques de nos produits...
J'ai donc le classeur en Pj, avec 3 onglets:
_liste produit à partir de laquelle je souhaite faire une macro pur éditer au format word les ft(je m'en suis pas encore occuper^^)
_une base de données étiquettes avec les listes d'ingrédients;
_et le modèle Ft , feuille sur laquelle je bosse en ce moment....et je galère!!!
J'ai réussi à faire ce code en m'inspirant un peu partout.
Seulement, il me faut lister tout les allergènes dans les 3 langues, je vais avoir un code assez lourds....mais ça peut encore le faire.
Par contre, chaque allergène n'est mis en gras qu'une fois....et je voudrai qu'ils tous soient mis en gras (si le mot lait est 3 fois dans la cellule=> 3 fois en gras)
Voici mon code (relié au bouton "allergène")
Code:
Sub allergène()
mot = " ble"
For Each c In Range("B2:B" & [B65000].End(xlUp).Row)
p = InStr(UCase(c), UCase(mot))
If p > 0 Then c.Characters(Start:=p, Length:=Len(mot)).Font.Bold = True
Next c
mot = "lait"
For Each c In Range("B2:B" & [B65000].End(xlUp).Row)
p = InStr(UCase(c), UCase(mot))
If p > 0 Then c.Characters(Start:=p, Length:=Len(mot)).Font.Bold = True
Next c
mot = "oeuf"
For Each c In Range("B2:B" & [B65000].End(xlUp).Row)
p = InStr(UCase(c), UCase(mot))
If p > 0 Then c.Characters(Start:=p, Length:=Len(mot)).Font.Bold = True
Next c
mot = "oeufs"
For Each c In Range("B2:B" & [B65000].End(xlUp).Row)
p = InStr(UCase(c), UCase(mot))
If p > 0 Then c.Characters(Start:=p, Length:=Len(mot)).Font.Bold = True
Next c
mot = "beurre"
For Each c In Range("B2:B" & [B65000].End(xlUp).Row)
p = InStr(UCase(c), UCase(mot))
If p > 0 Then c.Characters(Start:=p, Length:=Len(mot)).Font.Bold = True
Next c
mot = "soja"
For Each c In Range("B2:B" & [B65000].End(xlUp).Row)
p = InStr(UCase(c), UCase(mot))
If p > 0 Then c.Characters(Start:=p, Length:=Len(mot)).Font.Bold = True
Next c
mot = "sulfites"
For Each c In Range("B2:B" & [B65000].End(xlUp).Row)
p = InStr(UCase(c), UCase(mot))
If p > 0 Then c.Characters(Start:=p, Length:=Len(mot)).Font.Bold = True
Next c
mot = "SO2"
For Each c In Range("B2:B" & [B65000].End(xlUp).Row)
p = InStr(UCase(c), UCase(mot))
If p > 0 Then c.Characters(Start:=p, Length:=Len(mot)).Font.Bold = True
Next c
mot = "weat"
For Each c In Range("B2:B" & [B65000].End(xlUp).Row)
p = InStr(UCase(c), UCase(mot))
If p > 0 Then c.Characters(Start:=p, Length:=Len(mot)).Font.Bold = True
Next c
mot = "milk"
For Each c In Range("B2:B" & [B65000].End(xlUp).Row)
p = InStr(UCase(c), UCase(mot))
If p > 0 Then c.Characters(Start:=p, Length:=Len(mot)).Font.Bold = True
Next c
mot = "egg"
For Each c In Range("B2:B" & [B65000].End(xlUp).Row)
p = InStr(UCase(c), UCase(mot))
If p > 0 Then c.Characters(Start:=p, Length:=Len(mot)).Font.Bold = True
Next c
mot = "eggs"
For Each c In Range("B2:B" & [B65000].End(xlUp).Row)
p = InStr(UCase(c), UCase(mot))
If p > 0 Then c.Characters(Start:=p, Length:=Len(mot)).Font.Bold = True
Next c
mot = "soya"
For Each c In Range("B2:B" & [B65000].End(xlUp).Row)
p = InStr(UCase(c), UCase(mot))
If p > 0 Then c.Characters(Start:=p, Length:=Len(mot)).Font.Bold = True
Next c
mot = "sulphites"
For Each c In Range("B2:B" & [B65000].End(xlUp).Row)
p = InStr(UCase(c), UCase(mot))
If p > 0 Then c.Characters(Start:=p, Length:=Len(mot)).Font.Bold = True
Next c
mot = "leche"
For Each c In Range("B2:B" & [B65000].End(xlUp).Row)
p = InStr(UCase(c), UCase(mot))
If p > 0 Then c.Characters(Start:=p, Length:=Len(mot)).Font.Bold = True
Next c
mot = "huevos"
For Each c In Range("B2:B" & [B65000].End(xlUp).Row)
p = InStr(UCase(c), UCase(mot))
If p > 0 Then c.Characters(Start:=p, Length:=Len(mot)).Font.Bold = True
Next c
mot = "mantequilla"
For Each c In Range("B2:B" & [B65000].End(xlUp).Row)
p = InStr(UCase(c), UCase(mot))
If p > 0 Then c.Characters(Start:=p, Length:=Len(mot)).Font.Bold = True
Next c
mot = "trigo"
For Each c In Range("B2:B" & [B65000].End(xlUp).Row)
p = InStr(UCase(c), UCase(mot))
If p > 0 Then c.Characters(Start:=p, Length:=Len(mot)).Font.Bold = True
Next c
End Sub
Après, si vous avez une solution plus simple, comme utiliser la liste en colonne A....je suis preneur...je demande qu'à apprendre.
Merci par avance de votre aide!!!!!!
Cordialement.