Bonjour à tous,
J'utilise la macro ci-dessous, mais j'ai besoin de l'améliorer :
.
If Not Intersect(Target, Range("AM95:AM482")) Is Nothing Then
question = MsgBox("Est-ce un NEW ?", vbYesNo, Application.UserName)
If question = vbYes Then
question = MsgBox("La facturation se fait-elle sur 12 mois ?",
4, Application.UserName)
If question = 7 Then
Cells(Target.Row + 1, Target.Column) = "NEW": Exit Sub
Else
Application.EnableEvents = False
For lig = 95 To 130 Step 2
If Feuil2.Cells(lig, 1) = "" Then Exit For
Next
If lig > 130 Then MsgBox "complet":
Application.EnableEvents
= True: Exit Sub
mycol = Array(0, 1, 9, 24, 39, 63, 65)
For k = 1 To 6
Feuil2.Cells(lig, mycol(k)) = Feuil1.Cells(Target.Row,
mycol(k))
If Feuil1.Range("AF" & Target.Row) = "" Then
Feuil1.Cells(Target.Row, mycol(k)) = ""
Next
Target.Value = ""
End If
Application.EnableEvents = True
End If
End If
.
Tout d'abord, dans la plage considérée (AM95 : AM482), il faudrait que la
macro s'applique toutes les 2 lignes donc AM95, AM97, AM99, .
J'ai essayé Step 2 à divers endroits, mais j'ai une erreur de syntaxe.
Comment puis-je faire ?
Par ailleurs, après la première question (est-ce un NEW ?) :
si on répond oui on a tout le cheminement de la macro jusqu'au
copier/coller
ou couper/coller sur le feuille 2,
si on répond non, pour le moment, il ne se passe rien. Or, je souhaiterais
qu'une nouvelle question soit posée : Voulez-vous un module ?
si oui, question : est-ce un NEW ?
si oui, on inscrit en AS95 : module et en AS96 NEW (la plage complète sera
AS95 : AS482)
si non, nouvelle question : Souhaitez-vous un lien ?
si non, nouvelle question : Souhaitez-vous un lien ?
Voilà pour le moment.
Quelqu'un aurait-il une solution à me proposer ?
Je pense qu'ensuite je devrais pouvoir bien avancer seul, mais pour le
moment je n'ai aucune idée de comment imbriquer les nouvelles questions
dans
la macro existante.
D'avance, je vous remercie.
Nicoh
Bonjour à tous,
J'utilise la macro ci-dessous, mais j'ai besoin de l'améliorer :
.
If Not Intersect(Target, Range("AM95:AM482")) Is Nothing Then
question = MsgBox("Est-ce un NEW ?", vbYesNo, Application.UserName)
If question = vbYes Then
question = MsgBox("La facturation se fait-elle sur 12 mois ?",
4, Application.UserName)
If question = 7 Then
Cells(Target.Row + 1, Target.Column) = "NEW": Exit Sub
Else
Application.EnableEvents = False
For lig = 95 To 130 Step 2
If Feuil2.Cells(lig, 1) = "" Then Exit For
Next
If lig > 130 Then MsgBox "complet":
Application.EnableEvents
= True: Exit Sub
mycol = Array(0, 1, 9, 24, 39, 63, 65)
For k = 1 To 6
Feuil2.Cells(lig, mycol(k)) = Feuil1.Cells(Target.Row,
mycol(k))
If Feuil1.Range("AF" & Target.Row) = "" Then
Feuil1.Cells(Target.Row, mycol(k)) = ""
Next
Target.Value = ""
End If
Application.EnableEvents = True
End If
End If
.
Tout d'abord, dans la plage considérée (AM95 : AM482), il faudrait que la
macro s'applique toutes les 2 lignes donc AM95, AM97, AM99, .
J'ai essayé Step 2 à divers endroits, mais j'ai une erreur de syntaxe.
Comment puis-je faire ?
Par ailleurs, après la première question (est-ce un NEW ?) :
si on répond oui on a tout le cheminement de la macro jusqu'au
copier/coller
ou couper/coller sur le feuille 2,
si on répond non, pour le moment, il ne se passe rien. Or, je souhaiterais
qu'une nouvelle question soit posée : Voulez-vous un module ?
si oui, question : est-ce un NEW ?
si oui, on inscrit en AS95 : module et en AS96 NEW (la plage complète sera
AS95 : AS482)
si non, nouvelle question : Souhaitez-vous un lien ?
si non, nouvelle question : Souhaitez-vous un lien ?
Voilà pour le moment.
Quelqu'un aurait-il une solution à me proposer ?
Je pense qu'ensuite je devrais pouvoir bien avancer seul, mais pour le
moment je n'ai aucune idée de comment imbriquer les nouvelles questions
dans
la macro existante.
D'avance, je vous remercie.
Nicoh
Bonjour à tous,
J'utilise la macro ci-dessous, mais j'ai besoin de l'améliorer :
.
If Not Intersect(Target, Range("AM95:AM482")) Is Nothing Then
question = MsgBox("Est-ce un NEW ?", vbYesNo, Application.UserName)
If question = vbYes Then
question = MsgBox("La facturation se fait-elle sur 12 mois ?",
4, Application.UserName)
If question = 7 Then
Cells(Target.Row + 1, Target.Column) = "NEW": Exit Sub
Else
Application.EnableEvents = False
For lig = 95 To 130 Step 2
If Feuil2.Cells(lig, 1) = "" Then Exit For
Next
If lig > 130 Then MsgBox "complet":
Application.EnableEvents
= True: Exit Sub
mycol = Array(0, 1, 9, 24, 39, 63, 65)
For k = 1 To 6
Feuil2.Cells(lig, mycol(k)) = Feuil1.Cells(Target.Row,
mycol(k))
If Feuil1.Range("AF" & Target.Row) = "" Then
Feuil1.Cells(Target.Row, mycol(k)) = ""
Next
Target.Value = ""
End If
Application.EnableEvents = True
End If
End If
.
Tout d'abord, dans la plage considérée (AM95 : AM482), il faudrait que la
macro s'applique toutes les 2 lignes donc AM95, AM97, AM99, .
J'ai essayé Step 2 à divers endroits, mais j'ai une erreur de syntaxe.
Comment puis-je faire ?
Par ailleurs, après la première question (est-ce un NEW ?) :
si on répond oui on a tout le cheminement de la macro jusqu'au
copier/coller
ou couper/coller sur le feuille 2,
si on répond non, pour le moment, il ne se passe rien. Or, je souhaiterais
qu'une nouvelle question soit posée : Voulez-vous un module ?
si oui, question : est-ce un NEW ?
si oui, on inscrit en AS95 : module et en AS96 NEW (la plage complète sera
AS95 : AS482)
si non, nouvelle question : Souhaitez-vous un lien ?
si non, nouvelle question : Souhaitez-vous un lien ?
Voilà pour le moment.
Quelqu'un aurait-il une solution à me proposer ?
Je pense qu'ensuite je devrais pouvoir bien avancer seul, mais pour le
moment je n'ai aucune idée de comment imbriquer les nouvelles questions
dans
la macro existante.
D'avance, je vous remercie.
Nicoh
Merci beaucoup Youky pour ta réponse rapide !
J'ai inséré le code comme suit :
If Target.Row < 95 Or Target.Row > 482 Then Exit Sub
If Target.Column > 39 Then Exit Sub
If Target.Row Mod 2 = 0 Then Exit Sub
If Not Intersect(Target, Range("AM95:AM482")) Is Nothing Then
...
Ca fonctionne parfaitement, j'espère juste avoir inséré le code au bon
endroit.
Pour répondre à ta question, on peut continuer.
Nicoh
Merci beaucoup Youky pour ta réponse rapide !
J'ai inséré le code comme suit :
If Target.Row < 95 Or Target.Row > 482 Then Exit Sub
If Target.Column > 39 Then Exit Sub
If Target.Row Mod 2 = 0 Then Exit Sub
If Not Intersect(Target, Range("AM95:AM482")) Is Nothing Then
...
Ca fonctionne parfaitement, j'espère juste avoir inséré le code au bon
endroit.
Pour répondre à ta question, on peut continuer.
Nicoh
Merci beaucoup Youky pour ta réponse rapide !
J'ai inséré le code comme suit :
If Target.Row < 95 Or Target.Row > 482 Then Exit Sub
If Target.Column > 39 Then Exit Sub
If Target.Row Mod 2 = 0 Then Exit Sub
If Not Intersect(Target, Range("AM95:AM482")) Is Nothing Then
...
Ca fonctionne parfaitement, j'espère juste avoir inséré le code au bon
endroit.
Pour répondre à ta question, on peut continuer.
Nicoh
Bonjour Youky,
Merci pour ton aide. Je viens de voir, après avoir travaillé deux jours
sur
la macro, que tu as apporté une correction. Je n'en ai pas tenu compte
car
je suis arrivé en développant le code selon mes besoins à ce qu'il me
fallait. A une exception près ! C'était trop beau.
Ci-joint ta macro que j'ai personnalisé, elle est un peu longue. Tout ce
passe comme je souhaite, sauf pour le dernier "pavé" : If rep7 = vbNo Then
...
Là, rien ne se passe. Peut-être que les End If sont mal placés ? J'ai
essayé d'en bouger un certain nombre, mais rien n'y fait, je n'arrive pas
à
activer cette partie.
Peux-tu m'aiguiller STP ?
Merci beaucoup,
nicoh
If Target.Row < 95 Or Target.Row > 482 Then Exit Sub
If Target.Column < 39 Or Target.Column > 39 Then Exit Sub
If Target.Row Mod 2 = 0 Then Exit Sub
question = MsgBox("Est-ce un nouvel accès ?", vbYesNo,
Application.UserName)
If question = vbYes Then
question2 = MsgBox(" Le facture-t-on tout de suite ?", 4,
Application.UserName)
If question2 = vbYes Then
Cells(Target.Row + 1, Target.Column) = "NEW"
rep = MsgBox("Voulez-vous un module ?", vbYesNo)
If rep = vbYes Then rep2 = MsgBox("Le facture-t-on tout de
suite?", vbYesNo)
If rep2 = vbYes Then
Cells(Target.Row, Target.Column + 6) = "MODULE"
Cells(Target.Row + 1, Target.Column + 6) = "NEW"
rep3 = MsgBox("Voulez-vous un lien ?", vbYesNo)
If rep3 = vbYes Then rep4 = MsgBox("Le
facture-t-on
tout de suite?", vbYesNo)
If rep4 = vbYes Then
Cells(Target.Row, Target.Column + 12) =
"LIEN"
Cells(Target.Row + 1, Target.Column + 12) > "NEW"
Else
If rep4 = vbNo Then
Cells(Target.Row, Target.Column + 12) = "EN
ATTENTE"
End If
End If 'rep2
End If ' rep3
End If ' rep 4
If rep2 = vbNo Then
Cells(Target.Row, Target.Column + 6) = "EN ATTENTE"
End If
End If 'question2
If rep = vbNo Then rep5 = MsgBox("Voulez-vous un lien ?",
vbYesNo)
If rep5 = vbYes Then rep6 = MsgBox("Le
facture-ton tout de suite?", vbYesNo)
If rep6 = vbYes
Then
Cells(Target.Row,
Target.Column + 12) = "LIEN"
Cells(Target.Row +
1, Target.Column + 12) = "NEW"
Else
If rep6 = vbNo Then
Cells(Target.Row,
Target.Column + 12) = "EN ATTENTE"
End If 'rep6
End If 'rep5
If question2 = vbNo Then
Application.EnableEvents = False
For lig = 95 To 130 Step 2
If Feuil2.Cells(lig, 1) = "" Then Exit For
Next
If lig > 130 Then MsgBox "complet": Application.EnableEvents =
True:
Exit Sub
mycol = Array(0, 1, 9, 24, 39, 63, 65)
For k = 1 To 6
Feuil2.Cells(lig, mycol(k)) = Feuil1.Cells(Target.Row, mycol(k))
If Feuil1.Range("AF" & Target.Row) = "" Then _
Feuil1.Cells(Target.Row, mycol(k)) = ""
Next
Target.Value = ""
Application.EnableEvents = True
End If
If question = vbNo Then rep7 = MsgBox("Voulez-vous un module ?", vbYesNo,
Application.UserName)
If rep7 = vbYes Then
rep8 = MsgBox("Est-ce un nouveau
module ?", vbYesNo, Application.UserName)
If rep8 = vbYes Then
rep9 = MsgBox("Le
facture-t-on tout de suite?", vbYesNo, Application.UserName)
If rep9 = vbYes
Then
Cells(Target.Row,
Target.Column + 6) = "MODULE"
Cells(Target.Row +
1, Target.Column + 6) = "NEW"
rep10 > MsgBox("Souhaitez-vous un lien ?", vbYesNo)
If rep10 = vbYes
Then rep11 = MsgBox("Le facture-t-on tout de suite?", vbYesNo)
If rep11 = vbYes
Then
Cells(Target.Row,
Target.Column + 12) = "LIEN"
Cells(Target.Row +
1, Target.Column + 12) = "NEW"
End If
If rep11 = vbNo
Then
Cells(Target.Row,
Target.Column + 12) = "EN ATTENTE"
End If
End If
End If
If rep9 = vbNo Then
Cells(Target.Row,
Target.Column + 6) = "EN ATTENTE"
rep12 > MsgBox("Désirez-vous un lien ?", vbYesNo)
If rep12 = vbYes
Then rep13 = MsgBox("Le facture-t-on tout de suite?", vbYesNo)
If rep13 = vbYes
Then
Cells(Target.Row,
Target.Column + 12) = "LIEN"
Cells(Target.Row +
1, Target.Column + 12) = "NEW"
Else
If rep13 = vbNo
Then
Cells(Target.Row,
Target.Column + 12) = "EN ATTENTE"
End If
End If
End If
If rep8 = vbNo Then
Cells(Target.Row, Target.Column +
6) = "MODULE"
rep15 = MsgBox("Voulez-vous un
lien ?", vbYesNo)
If rep15 = vbYes Then rep16 > MsgBox("Le facture-t-on de suite ?", vbYesNo)
If rep16 = vbYes Then
Cells(Target.Row, Target.Column +
12) = "LIEN"
Cells(Target.Row + 1,
Target.Column + 12) = "NEW"
Else
If rep16 = vbNo Then
Cells(Target.Row, Target.Column +
12) = "EN ATTENTE"
End If
End If
End If
If rep7 = vbNo Then
rep17 = MsgBox("Souhaitez-vous un
lien?", vbYesNo)
If rep17 = vbYes Then rep18 > MsgBox("Le facture-t-on de suite ?", vbYesNo)
If rep18 = vbYes
Then
Cells(Target.Row,
Target.Column + 12) = "LIEN"
Cells(Target.Row +
1,
Target.Column + 12) = "NEW"
Else
If rep17 = vbNo Then
Cells(Target.Row, Target.Column +
12) = "EN ATTENTE"
End If
End If
End If
End If ' question
Bonjour Youky,
Merci pour ton aide. Je viens de voir, après avoir travaillé deux jours
sur
la macro, que tu as apporté une correction. Je n'en ai pas tenu compte
car
je suis arrivé en développant le code selon mes besoins à ce qu'il me
fallait. A une exception près ! C'était trop beau.
Ci-joint ta macro que j'ai personnalisé, elle est un peu longue. Tout ce
passe comme je souhaite, sauf pour le dernier "pavé" : If rep7 = vbNo Then
...
Là, rien ne se passe. Peut-être que les End If sont mal placés ? J'ai
essayé d'en bouger un certain nombre, mais rien n'y fait, je n'arrive pas
à
activer cette partie.
Peux-tu m'aiguiller STP ?
Merci beaucoup,
nicoh
If Target.Row < 95 Or Target.Row > 482 Then Exit Sub
If Target.Column < 39 Or Target.Column > 39 Then Exit Sub
If Target.Row Mod 2 = 0 Then Exit Sub
question = MsgBox("Est-ce un nouvel accès ?", vbYesNo,
Application.UserName)
If question = vbYes Then
question2 = MsgBox(" Le facture-t-on tout de suite ?", 4,
Application.UserName)
If question2 = vbYes Then
Cells(Target.Row + 1, Target.Column) = "NEW"
rep = MsgBox("Voulez-vous un module ?", vbYesNo)
If rep = vbYes Then rep2 = MsgBox("Le facture-t-on tout de
suite?", vbYesNo)
If rep2 = vbYes Then
Cells(Target.Row, Target.Column + 6) = "MODULE"
Cells(Target.Row + 1, Target.Column + 6) = "NEW"
rep3 = MsgBox("Voulez-vous un lien ?", vbYesNo)
If rep3 = vbYes Then rep4 = MsgBox("Le
facture-t-on
tout de suite?", vbYesNo)
If rep4 = vbYes Then
Cells(Target.Row, Target.Column + 12) =
"LIEN"
Cells(Target.Row + 1, Target.Column + 12) > "NEW"
Else
If rep4 = vbNo Then
Cells(Target.Row, Target.Column + 12) = "EN
ATTENTE"
End If
End If 'rep2
End If ' rep3
End If ' rep 4
If rep2 = vbNo Then
Cells(Target.Row, Target.Column + 6) = "EN ATTENTE"
End If
End If 'question2
If rep = vbNo Then rep5 = MsgBox("Voulez-vous un lien ?",
vbYesNo)
If rep5 = vbYes Then rep6 = MsgBox("Le
facture-ton tout de suite?", vbYesNo)
If rep6 = vbYes
Then
Cells(Target.Row,
Target.Column + 12) = "LIEN"
Cells(Target.Row +
1, Target.Column + 12) = "NEW"
Else
If rep6 = vbNo Then
Cells(Target.Row,
Target.Column + 12) = "EN ATTENTE"
End If 'rep6
End If 'rep5
If question2 = vbNo Then
Application.EnableEvents = False
For lig = 95 To 130 Step 2
If Feuil2.Cells(lig, 1) = "" Then Exit For
Next
If lig > 130 Then MsgBox "complet": Application.EnableEvents =
True:
Exit Sub
mycol = Array(0, 1, 9, 24, 39, 63, 65)
For k = 1 To 6
Feuil2.Cells(lig, mycol(k)) = Feuil1.Cells(Target.Row, mycol(k))
If Feuil1.Range("AF" & Target.Row) = "" Then _
Feuil1.Cells(Target.Row, mycol(k)) = ""
Next
Target.Value = ""
Application.EnableEvents = True
End If
If question = vbNo Then rep7 = MsgBox("Voulez-vous un module ?", vbYesNo,
Application.UserName)
If rep7 = vbYes Then
rep8 = MsgBox("Est-ce un nouveau
module ?", vbYesNo, Application.UserName)
If rep8 = vbYes Then
rep9 = MsgBox("Le
facture-t-on tout de suite?", vbYesNo, Application.UserName)
If rep9 = vbYes
Then
Cells(Target.Row,
Target.Column + 6) = "MODULE"
Cells(Target.Row +
1, Target.Column + 6) = "NEW"
rep10 > MsgBox("Souhaitez-vous un lien ?", vbYesNo)
If rep10 = vbYes
Then rep11 = MsgBox("Le facture-t-on tout de suite?", vbYesNo)
If rep11 = vbYes
Then
Cells(Target.Row,
Target.Column + 12) = "LIEN"
Cells(Target.Row +
1, Target.Column + 12) = "NEW"
End If
If rep11 = vbNo
Then
Cells(Target.Row,
Target.Column + 12) = "EN ATTENTE"
End If
End If
End If
If rep9 = vbNo Then
Cells(Target.Row,
Target.Column + 6) = "EN ATTENTE"
rep12 > MsgBox("Désirez-vous un lien ?", vbYesNo)
If rep12 = vbYes
Then rep13 = MsgBox("Le facture-t-on tout de suite?", vbYesNo)
If rep13 = vbYes
Then
Cells(Target.Row,
Target.Column + 12) = "LIEN"
Cells(Target.Row +
1, Target.Column + 12) = "NEW"
Else
If rep13 = vbNo
Then
Cells(Target.Row,
Target.Column + 12) = "EN ATTENTE"
End If
End If
End If
If rep8 = vbNo Then
Cells(Target.Row, Target.Column +
6) = "MODULE"
rep15 = MsgBox("Voulez-vous un
lien ?", vbYesNo)
If rep15 = vbYes Then rep16 > MsgBox("Le facture-t-on de suite ?", vbYesNo)
If rep16 = vbYes Then
Cells(Target.Row, Target.Column +
12) = "LIEN"
Cells(Target.Row + 1,
Target.Column + 12) = "NEW"
Else
If rep16 = vbNo Then
Cells(Target.Row, Target.Column +
12) = "EN ATTENTE"
End If
End If
End If
If rep7 = vbNo Then
rep17 = MsgBox("Souhaitez-vous un
lien?", vbYesNo)
If rep17 = vbYes Then rep18 > MsgBox("Le facture-t-on de suite ?", vbYesNo)
If rep18 = vbYes
Then
Cells(Target.Row,
Target.Column + 12) = "LIEN"
Cells(Target.Row +
1,
Target.Column + 12) = "NEW"
Else
If rep17 = vbNo Then
Cells(Target.Row, Target.Column +
12) = "EN ATTENTE"
End If
End If
End If
End If ' question
Bonjour Youky,
Merci pour ton aide. Je viens de voir, après avoir travaillé deux jours
sur
la macro, que tu as apporté une correction. Je n'en ai pas tenu compte
car
je suis arrivé en développant le code selon mes besoins à ce qu'il me
fallait. A une exception près ! C'était trop beau.
Ci-joint ta macro que j'ai personnalisé, elle est un peu longue. Tout ce
passe comme je souhaite, sauf pour le dernier "pavé" : If rep7 = vbNo Then
...
Là, rien ne se passe. Peut-être que les End If sont mal placés ? J'ai
essayé d'en bouger un certain nombre, mais rien n'y fait, je n'arrive pas
à
activer cette partie.
Peux-tu m'aiguiller STP ?
Merci beaucoup,
nicoh
If Target.Row < 95 Or Target.Row > 482 Then Exit Sub
If Target.Column < 39 Or Target.Column > 39 Then Exit Sub
If Target.Row Mod 2 = 0 Then Exit Sub
question = MsgBox("Est-ce un nouvel accès ?", vbYesNo,
Application.UserName)
If question = vbYes Then
question2 = MsgBox(" Le facture-t-on tout de suite ?", 4,
Application.UserName)
If question2 = vbYes Then
Cells(Target.Row + 1, Target.Column) = "NEW"
rep = MsgBox("Voulez-vous un module ?", vbYesNo)
If rep = vbYes Then rep2 = MsgBox("Le facture-t-on tout de
suite?", vbYesNo)
If rep2 = vbYes Then
Cells(Target.Row, Target.Column + 6) = "MODULE"
Cells(Target.Row + 1, Target.Column + 6) = "NEW"
rep3 = MsgBox("Voulez-vous un lien ?", vbYesNo)
If rep3 = vbYes Then rep4 = MsgBox("Le
facture-t-on
tout de suite?", vbYesNo)
If rep4 = vbYes Then
Cells(Target.Row, Target.Column + 12) =
"LIEN"
Cells(Target.Row + 1, Target.Column + 12) > "NEW"
Else
If rep4 = vbNo Then
Cells(Target.Row, Target.Column + 12) = "EN
ATTENTE"
End If
End If 'rep2
End If ' rep3
End If ' rep 4
If rep2 = vbNo Then
Cells(Target.Row, Target.Column + 6) = "EN ATTENTE"
End If
End If 'question2
If rep = vbNo Then rep5 = MsgBox("Voulez-vous un lien ?",
vbYesNo)
If rep5 = vbYes Then rep6 = MsgBox("Le
facture-ton tout de suite?", vbYesNo)
If rep6 = vbYes
Then
Cells(Target.Row,
Target.Column + 12) = "LIEN"
Cells(Target.Row +
1, Target.Column + 12) = "NEW"
Else
If rep6 = vbNo Then
Cells(Target.Row,
Target.Column + 12) = "EN ATTENTE"
End If 'rep6
End If 'rep5
If question2 = vbNo Then
Application.EnableEvents = False
For lig = 95 To 130 Step 2
If Feuil2.Cells(lig, 1) = "" Then Exit For
Next
If lig > 130 Then MsgBox "complet": Application.EnableEvents =
True:
Exit Sub
mycol = Array(0, 1, 9, 24, 39, 63, 65)
For k = 1 To 6
Feuil2.Cells(lig, mycol(k)) = Feuil1.Cells(Target.Row, mycol(k))
If Feuil1.Range("AF" & Target.Row) = "" Then _
Feuil1.Cells(Target.Row, mycol(k)) = ""
Next
Target.Value = ""
Application.EnableEvents = True
End If
If question = vbNo Then rep7 = MsgBox("Voulez-vous un module ?", vbYesNo,
Application.UserName)
If rep7 = vbYes Then
rep8 = MsgBox("Est-ce un nouveau
module ?", vbYesNo, Application.UserName)
If rep8 = vbYes Then
rep9 = MsgBox("Le
facture-t-on tout de suite?", vbYesNo, Application.UserName)
If rep9 = vbYes
Then
Cells(Target.Row,
Target.Column + 6) = "MODULE"
Cells(Target.Row +
1, Target.Column + 6) = "NEW"
rep10 > MsgBox("Souhaitez-vous un lien ?", vbYesNo)
If rep10 = vbYes
Then rep11 = MsgBox("Le facture-t-on tout de suite?", vbYesNo)
If rep11 = vbYes
Then
Cells(Target.Row,
Target.Column + 12) = "LIEN"
Cells(Target.Row +
1, Target.Column + 12) = "NEW"
End If
If rep11 = vbNo
Then
Cells(Target.Row,
Target.Column + 12) = "EN ATTENTE"
End If
End If
End If
If rep9 = vbNo Then
Cells(Target.Row,
Target.Column + 6) = "EN ATTENTE"
rep12 > MsgBox("Désirez-vous un lien ?", vbYesNo)
If rep12 = vbYes
Then rep13 = MsgBox("Le facture-t-on tout de suite?", vbYesNo)
If rep13 = vbYes
Then
Cells(Target.Row,
Target.Column + 12) = "LIEN"
Cells(Target.Row +
1, Target.Column + 12) = "NEW"
Else
If rep13 = vbNo
Then
Cells(Target.Row,
Target.Column + 12) = "EN ATTENTE"
End If
End If
End If
If rep8 = vbNo Then
Cells(Target.Row, Target.Column +
6) = "MODULE"
rep15 = MsgBox("Voulez-vous un
lien ?", vbYesNo)
If rep15 = vbYes Then rep16 > MsgBox("Le facture-t-on de suite ?", vbYesNo)
If rep16 = vbYes Then
Cells(Target.Row, Target.Column +
12) = "LIEN"
Cells(Target.Row + 1,
Target.Column + 12) = "NEW"
Else
If rep16 = vbNo Then
Cells(Target.Row, Target.Column +
12) = "EN ATTENTE"
End If
End If
End If
If rep7 = vbNo Then
rep17 = MsgBox("Souhaitez-vous un
lien?", vbYesNo)
If rep17 = vbYes Then rep18 > MsgBox("Le facture-t-on de suite ?", vbYesNo)
If rep18 = vbYes
Then
Cells(Target.Row,
Target.Column + 12) = "LIEN"
Cells(Target.Row +
1,
Target.Column + 12) = "NEW"
Else
If rep17 = vbNo Then
Cells(Target.Row, Target.Column +
12) = "EN ATTENTE"
End If
End If
End If
End If ' question
J'avoue que j'ai du mal pour m'y retrouver
Le bon placement des EndIf est important.
Devant ce nombre important de Msgbox ne serait'il pas judicieux d'utiliser
un userform
avec différents boutons expliquant chaque situation et aller direct au but.
Quitte même d'avoir plusieurs userform les News ou pas News et
exemple caption d'un bouton "Facturation immédiate" ou "Facturation
différée"
Rien n'empeche de mettre des msgbox derriere les boutons, je pense que cela
peut mener
plus rapidement l'utilisateur à son but.
Avec trop de questions on risque de ne plus savoir ou l'on en est.
A toi de voir...
Bonne chance pour replacer le End If
Youky
"Nicoh" a écrit dans le message de news:Bonjour Youky,
Merci pour ton aide. Je viens de voir, après avoir travaillé deux jours
sur
la macro, que tu as apporté une correction. Je n'en ai pas tenu compte
car
je suis arrivé en développant le code selon mes besoins à ce qu'il me
fallait. A une exception près ! C'était trop beau.
Ci-joint ta macro que j'ai personnalisé, elle est un peu longue. Tout ce
passe comme je souhaite, sauf pour le dernier "pavé" : If rep7 = vbNo Then
...
Là, rien ne se passe. Peut-être que les End If sont mal placés ? J'ai
essayé d'en bouger un certain nombre, mais rien n'y fait, je n'arrive pas
à
activer cette partie.
Peux-tu m'aiguiller STP ?
Merci beaucoup,
nicoh
If Target.Row < 95 Or Target.Row > 482 Then Exit Sub
If Target.Column < 39 Or Target.Column > 39 Then Exit Sub
If Target.Row Mod 2 = 0 Then Exit Sub
question = MsgBox("Est-ce un nouvel accès ?", vbYesNo,
Application.UserName)
If question = vbYes Then
question2 = MsgBox(" Le facture-t-on tout de suite ?", 4,
Application.UserName)
If question2 = vbYes Then
Cells(Target.Row + 1, Target.Column) = "NEW"
rep = MsgBox("Voulez-vous un module ?", vbYesNo)
If rep = vbYes Then rep2 = MsgBox("Le facture-t-on tout de
suite?", vbYesNo)
If rep2 = vbYes Then
Cells(Target.Row, Target.Column + 6) = "MODULE"
Cells(Target.Row + 1, Target.Column + 6) = "NEW"
rep3 = MsgBox("Voulez-vous un lien ?", vbYesNo)
If rep3 = vbYes Then rep4 = MsgBox("Le
facture-t-on
tout de suite?", vbYesNo)
If rep4 = vbYes Then
Cells(Target.Row, Target.Column + 12) =
"LIEN"
Cells(Target.Row + 1, Target.Column + 12) > > "NEW"
Else
If rep4 = vbNo Then
Cells(Target.Row, Target.Column + 12) = "EN
ATTENTE"
End If
End If 'rep2
End If ' rep3
End If ' rep 4
If rep2 = vbNo Then
Cells(Target.Row, Target.Column + 6) = "EN ATTENTE"
End If
End If 'question2
If rep = vbNo Then rep5 = MsgBox("Voulez-vous un lien ?",
vbYesNo)
If rep5 = vbYes Then rep6 = MsgBox("Le
facture-ton tout de suite?", vbYesNo)
If rep6 = vbYes
Then
Cells(Target.Row,
Target.Column + 12) = "LIEN"
Cells(Target.Row +
1, Target.Column + 12) = "NEW"
Else
If rep6 = vbNo Then
Cells(Target.Row,
Target.Column + 12) = "EN ATTENTE"
End If 'rep6
End If 'rep5
If question2 = vbNo Then
Application.EnableEvents = False
For lig = 95 To 130 Step 2
If Feuil2.Cells(lig, 1) = "" Then Exit For
Next
If lig > 130 Then MsgBox "complet": Application.EnableEvents =
True:
Exit Sub
mycol = Array(0, 1, 9, 24, 39, 63, 65)
For k = 1 To 6
Feuil2.Cells(lig, mycol(k)) = Feuil1.Cells(Target.Row, mycol(k))
If Feuil1.Range("AF" & Target.Row) = "" Then _
Feuil1.Cells(Target.Row, mycol(k)) = ""
Next
Target.Value = ""
Application.EnableEvents = True
End If
If question = vbNo Then rep7 = MsgBox("Voulez-vous un module ?", vbYesNo,
Application.UserName)
If rep7 = vbYes Then
rep8 = MsgBox("Est-ce un nouveau
module ?", vbYesNo, Application.UserName)
If rep8 = vbYes Then
rep9 = MsgBox("Le
facture-t-on tout de suite?", vbYesNo, Application.UserName)
If rep9 = vbYes
Then
Cells(Target.Row,
Target.Column + 6) = "MODULE"
Cells(Target.Row +
1, Target.Column + 6) = "NEW"
rep10 > > MsgBox("Souhaitez-vous un lien ?", vbYesNo)
If rep10 = vbYes
Then rep11 = MsgBox("Le facture-t-on tout de suite?", vbYesNo)
If rep11 = vbYes
Then
Cells(Target.Row,
Target.Column + 12) = "LIEN"
Cells(Target.Row +
1, Target.Column + 12) = "NEW"
End If
If rep11 = vbNo
Then
Cells(Target.Row,
Target.Column + 12) = "EN ATTENTE"
End If
End If
End If
If rep9 = vbNo Then
Cells(Target.Row,
Target.Column + 6) = "EN ATTENTE"
rep12 > > MsgBox("Désirez-vous un lien ?", vbYesNo)
If rep12 = vbYes
Then rep13 = MsgBox("Le facture-t-on tout de suite?", vbYesNo)
If rep13 = vbYes
Then
Cells(Target.Row,
Target.Column + 12) = "LIEN"
Cells(Target.Row +
1, Target.Column + 12) = "NEW"
Else
If rep13 = vbNo
Then
Cells(Target.Row,
Target.Column + 12) = "EN ATTENTE"
End If
End If
End If
If rep8 = vbNo Then
Cells(Target.Row, Target.Column +
6) = "MODULE"
rep15 = MsgBox("Voulez-vous un
lien ?", vbYesNo)
If rep15 = vbYes Then rep16 > > MsgBox("Le facture-t-on de suite ?", vbYesNo)
If rep16 = vbYes Then
Cells(Target.Row, Target.Column +
12) = "LIEN"
Cells(Target.Row + 1,
Target.Column + 12) = "NEW"
Else
If rep16 = vbNo Then
Cells(Target.Row, Target.Column +
12) = "EN ATTENTE"
End If
End If
End If
If rep7 = vbNo Then
rep17 = MsgBox("Souhaitez-vous un
lien?", vbYesNo)
If rep17 = vbYes Then rep18 > > MsgBox("Le facture-t-on de suite ?", vbYesNo)
If rep18 = vbYes
Then
Cells(Target.Row,
Target.Column + 12) = "LIEN"
Cells(Target.Row +
1,
Target.Column + 12) = "NEW"
Else
If rep17 = vbNo Then
Cells(Target.Row, Target.Column +
12) = "EN ATTENTE"
End If
End If
End If
End If ' question
J'avoue que j'ai du mal pour m'y retrouver
Le bon placement des EndIf est important.
Devant ce nombre important de Msgbox ne serait'il pas judicieux d'utiliser
un userform
avec différents boutons expliquant chaque situation et aller direct au but.
Quitte même d'avoir plusieurs userform les News ou pas News et
exemple caption d'un bouton "Facturation immédiate" ou "Facturation
différée"
Rien n'empeche de mettre des msgbox derriere les boutons, je pense que cela
peut mener
plus rapidement l'utilisateur à son but.
Avec trop de questions on risque de ne plus savoir ou l'on en est.
A toi de voir...
Bonne chance pour replacer le End If
Youky
"Nicoh" <Nicoh@discussions.microsoft.com> a écrit dans le message de news:
8244BD5A-06E8-4A62-9FDE-3E05F25F9005@microsoft.com...
Bonjour Youky,
Merci pour ton aide. Je viens de voir, après avoir travaillé deux jours
sur
la macro, que tu as apporté une correction. Je n'en ai pas tenu compte
car
je suis arrivé en développant le code selon mes besoins à ce qu'il me
fallait. A une exception près ! C'était trop beau.
Ci-joint ta macro que j'ai personnalisé, elle est un peu longue. Tout ce
passe comme je souhaite, sauf pour le dernier "pavé" : If rep7 = vbNo Then
...
Là, rien ne se passe. Peut-être que les End If sont mal placés ? J'ai
essayé d'en bouger un certain nombre, mais rien n'y fait, je n'arrive pas
à
activer cette partie.
Peux-tu m'aiguiller STP ?
Merci beaucoup,
nicoh
If Target.Row < 95 Or Target.Row > 482 Then Exit Sub
If Target.Column < 39 Or Target.Column > 39 Then Exit Sub
If Target.Row Mod 2 = 0 Then Exit Sub
question = MsgBox("Est-ce un nouvel accès ?", vbYesNo,
Application.UserName)
If question = vbYes Then
question2 = MsgBox(" Le facture-t-on tout de suite ?", 4,
Application.UserName)
If question2 = vbYes Then
Cells(Target.Row + 1, Target.Column) = "NEW"
rep = MsgBox("Voulez-vous un module ?", vbYesNo)
If rep = vbYes Then rep2 = MsgBox("Le facture-t-on tout de
suite?", vbYesNo)
If rep2 = vbYes Then
Cells(Target.Row, Target.Column + 6) = "MODULE"
Cells(Target.Row + 1, Target.Column + 6) = "NEW"
rep3 = MsgBox("Voulez-vous un lien ?", vbYesNo)
If rep3 = vbYes Then rep4 = MsgBox("Le
facture-t-on
tout de suite?", vbYesNo)
If rep4 = vbYes Then
Cells(Target.Row, Target.Column + 12) =
"LIEN"
Cells(Target.Row + 1, Target.Column + 12) > > "NEW"
Else
If rep4 = vbNo Then
Cells(Target.Row, Target.Column + 12) = "EN
ATTENTE"
End If
End If 'rep2
End If ' rep3
End If ' rep 4
If rep2 = vbNo Then
Cells(Target.Row, Target.Column + 6) = "EN ATTENTE"
End If
End If 'question2
If rep = vbNo Then rep5 = MsgBox("Voulez-vous un lien ?",
vbYesNo)
If rep5 = vbYes Then rep6 = MsgBox("Le
facture-ton tout de suite?", vbYesNo)
If rep6 = vbYes
Then
Cells(Target.Row,
Target.Column + 12) = "LIEN"
Cells(Target.Row +
1, Target.Column + 12) = "NEW"
Else
If rep6 = vbNo Then
Cells(Target.Row,
Target.Column + 12) = "EN ATTENTE"
End If 'rep6
End If 'rep5
If question2 = vbNo Then
Application.EnableEvents = False
For lig = 95 To 130 Step 2
If Feuil2.Cells(lig, 1) = "" Then Exit For
Next
If lig > 130 Then MsgBox "complet": Application.EnableEvents =
True:
Exit Sub
mycol = Array(0, 1, 9, 24, 39, 63, 65)
For k = 1 To 6
Feuil2.Cells(lig, mycol(k)) = Feuil1.Cells(Target.Row, mycol(k))
If Feuil1.Range("AF" & Target.Row) = "" Then _
Feuil1.Cells(Target.Row, mycol(k)) = ""
Next
Target.Value = ""
Application.EnableEvents = True
End If
If question = vbNo Then rep7 = MsgBox("Voulez-vous un module ?", vbYesNo,
Application.UserName)
If rep7 = vbYes Then
rep8 = MsgBox("Est-ce un nouveau
module ?", vbYesNo, Application.UserName)
If rep8 = vbYes Then
rep9 = MsgBox("Le
facture-t-on tout de suite?", vbYesNo, Application.UserName)
If rep9 = vbYes
Then
Cells(Target.Row,
Target.Column + 6) = "MODULE"
Cells(Target.Row +
1, Target.Column + 6) = "NEW"
rep10 > > MsgBox("Souhaitez-vous un lien ?", vbYesNo)
If rep10 = vbYes
Then rep11 = MsgBox("Le facture-t-on tout de suite?", vbYesNo)
If rep11 = vbYes
Then
Cells(Target.Row,
Target.Column + 12) = "LIEN"
Cells(Target.Row +
1, Target.Column + 12) = "NEW"
End If
If rep11 = vbNo
Then
Cells(Target.Row,
Target.Column + 12) = "EN ATTENTE"
End If
End If
End If
If rep9 = vbNo Then
Cells(Target.Row,
Target.Column + 6) = "EN ATTENTE"
rep12 > > MsgBox("Désirez-vous un lien ?", vbYesNo)
If rep12 = vbYes
Then rep13 = MsgBox("Le facture-t-on tout de suite?", vbYesNo)
If rep13 = vbYes
Then
Cells(Target.Row,
Target.Column + 12) = "LIEN"
Cells(Target.Row +
1, Target.Column + 12) = "NEW"
Else
If rep13 = vbNo
Then
Cells(Target.Row,
Target.Column + 12) = "EN ATTENTE"
End If
End If
End If
If rep8 = vbNo Then
Cells(Target.Row, Target.Column +
6) = "MODULE"
rep15 = MsgBox("Voulez-vous un
lien ?", vbYesNo)
If rep15 = vbYes Then rep16 > > MsgBox("Le facture-t-on de suite ?", vbYesNo)
If rep16 = vbYes Then
Cells(Target.Row, Target.Column +
12) = "LIEN"
Cells(Target.Row + 1,
Target.Column + 12) = "NEW"
Else
If rep16 = vbNo Then
Cells(Target.Row, Target.Column +
12) = "EN ATTENTE"
End If
End If
End If
If rep7 = vbNo Then
rep17 = MsgBox("Souhaitez-vous un
lien?", vbYesNo)
If rep17 = vbYes Then rep18 > > MsgBox("Le facture-t-on de suite ?", vbYesNo)
If rep18 = vbYes
Then
Cells(Target.Row,
Target.Column + 12) = "LIEN"
Cells(Target.Row +
1,
Target.Column + 12) = "NEW"
Else
If rep17 = vbNo Then
Cells(Target.Row, Target.Column +
12) = "EN ATTENTE"
End If
End If
End If
End If ' question
J'avoue que j'ai du mal pour m'y retrouver
Le bon placement des EndIf est important.
Devant ce nombre important de Msgbox ne serait'il pas judicieux d'utiliser
un userform
avec différents boutons expliquant chaque situation et aller direct au but.
Quitte même d'avoir plusieurs userform les News ou pas News et
exemple caption d'un bouton "Facturation immédiate" ou "Facturation
différée"
Rien n'empeche de mettre des msgbox derriere les boutons, je pense que cela
peut mener
plus rapidement l'utilisateur à son but.
Avec trop de questions on risque de ne plus savoir ou l'on en est.
A toi de voir...
Bonne chance pour replacer le End If
Youky
"Nicoh" a écrit dans le message de news:Bonjour Youky,
Merci pour ton aide. Je viens de voir, après avoir travaillé deux jours
sur
la macro, que tu as apporté une correction. Je n'en ai pas tenu compte
car
je suis arrivé en développant le code selon mes besoins à ce qu'il me
fallait. A une exception près ! C'était trop beau.
Ci-joint ta macro que j'ai personnalisé, elle est un peu longue. Tout ce
passe comme je souhaite, sauf pour le dernier "pavé" : If rep7 = vbNo Then
...
Là, rien ne se passe. Peut-être que les End If sont mal placés ? J'ai
essayé d'en bouger un certain nombre, mais rien n'y fait, je n'arrive pas
à
activer cette partie.
Peux-tu m'aiguiller STP ?
Merci beaucoup,
nicoh
If Target.Row < 95 Or Target.Row > 482 Then Exit Sub
If Target.Column < 39 Or Target.Column > 39 Then Exit Sub
If Target.Row Mod 2 = 0 Then Exit Sub
question = MsgBox("Est-ce un nouvel accès ?", vbYesNo,
Application.UserName)
If question = vbYes Then
question2 = MsgBox(" Le facture-t-on tout de suite ?", 4,
Application.UserName)
If question2 = vbYes Then
Cells(Target.Row + 1, Target.Column) = "NEW"
rep = MsgBox("Voulez-vous un module ?", vbYesNo)
If rep = vbYes Then rep2 = MsgBox("Le facture-t-on tout de
suite?", vbYesNo)
If rep2 = vbYes Then
Cells(Target.Row, Target.Column + 6) = "MODULE"
Cells(Target.Row + 1, Target.Column + 6) = "NEW"
rep3 = MsgBox("Voulez-vous un lien ?", vbYesNo)
If rep3 = vbYes Then rep4 = MsgBox("Le
facture-t-on
tout de suite?", vbYesNo)
If rep4 = vbYes Then
Cells(Target.Row, Target.Column + 12) =
"LIEN"
Cells(Target.Row + 1, Target.Column + 12) > > "NEW"
Else
If rep4 = vbNo Then
Cells(Target.Row, Target.Column + 12) = "EN
ATTENTE"
End If
End If 'rep2
End If ' rep3
End If ' rep 4
If rep2 = vbNo Then
Cells(Target.Row, Target.Column + 6) = "EN ATTENTE"
End If
End If 'question2
If rep = vbNo Then rep5 = MsgBox("Voulez-vous un lien ?",
vbYesNo)
If rep5 = vbYes Then rep6 = MsgBox("Le
facture-ton tout de suite?", vbYesNo)
If rep6 = vbYes
Then
Cells(Target.Row,
Target.Column + 12) = "LIEN"
Cells(Target.Row +
1, Target.Column + 12) = "NEW"
Else
If rep6 = vbNo Then
Cells(Target.Row,
Target.Column + 12) = "EN ATTENTE"
End If 'rep6
End If 'rep5
If question2 = vbNo Then
Application.EnableEvents = False
For lig = 95 To 130 Step 2
If Feuil2.Cells(lig, 1) = "" Then Exit For
Next
If lig > 130 Then MsgBox "complet": Application.EnableEvents =
True:
Exit Sub
mycol = Array(0, 1, 9, 24, 39, 63, 65)
For k = 1 To 6
Feuil2.Cells(lig, mycol(k)) = Feuil1.Cells(Target.Row, mycol(k))
If Feuil1.Range("AF" & Target.Row) = "" Then _
Feuil1.Cells(Target.Row, mycol(k)) = ""
Next
Target.Value = ""
Application.EnableEvents = True
End If
If question = vbNo Then rep7 = MsgBox("Voulez-vous un module ?", vbYesNo,
Application.UserName)
If rep7 = vbYes Then
rep8 = MsgBox("Est-ce un nouveau
module ?", vbYesNo, Application.UserName)
If rep8 = vbYes Then
rep9 = MsgBox("Le
facture-t-on tout de suite?", vbYesNo, Application.UserName)
If rep9 = vbYes
Then
Cells(Target.Row,
Target.Column + 6) = "MODULE"
Cells(Target.Row +
1, Target.Column + 6) = "NEW"
rep10 > > MsgBox("Souhaitez-vous un lien ?", vbYesNo)
If rep10 = vbYes
Then rep11 = MsgBox("Le facture-t-on tout de suite?", vbYesNo)
If rep11 = vbYes
Then
Cells(Target.Row,
Target.Column + 12) = "LIEN"
Cells(Target.Row +
1, Target.Column + 12) = "NEW"
End If
If rep11 = vbNo
Then
Cells(Target.Row,
Target.Column + 12) = "EN ATTENTE"
End If
End If
End If
If rep9 = vbNo Then
Cells(Target.Row,
Target.Column + 6) = "EN ATTENTE"
rep12 > > MsgBox("Désirez-vous un lien ?", vbYesNo)
If rep12 = vbYes
Then rep13 = MsgBox("Le facture-t-on tout de suite?", vbYesNo)
If rep13 = vbYes
Then
Cells(Target.Row,
Target.Column + 12) = "LIEN"
Cells(Target.Row +
1, Target.Column + 12) = "NEW"
Else
If rep13 = vbNo
Then
Cells(Target.Row,
Target.Column + 12) = "EN ATTENTE"
End If
End If
End If
If rep8 = vbNo Then
Cells(Target.Row, Target.Column +
6) = "MODULE"
rep15 = MsgBox("Voulez-vous un
lien ?", vbYesNo)
If rep15 = vbYes Then rep16 > > MsgBox("Le facture-t-on de suite ?", vbYesNo)
If rep16 = vbYes Then
Cells(Target.Row, Target.Column +
12) = "LIEN"
Cells(Target.Row + 1,
Target.Column + 12) = "NEW"
Else
If rep16 = vbNo Then
Cells(Target.Row, Target.Column +
12) = "EN ATTENTE"
End If
End If
End If
If rep7 = vbNo Then
rep17 = MsgBox("Souhaitez-vous un
lien?", vbYesNo)
If rep17 = vbYes Then rep18 > > MsgBox("Le facture-t-on de suite ?", vbYesNo)
If rep18 = vbYes
Then
Cells(Target.Row,
Target.Column + 12) = "LIEN"
Cells(Target.Row +
1,
Target.Column + 12) = "NEW"
Else
If rep17 = vbNo Then
Cells(Target.Row, Target.Column +
12) = "EN ATTENTE"
End If
End If
End If
End If ' question