G
Ganache
Guest
BOnjour !!!
J'ai un petit probleme avec ma maccro.
La condition si l'utilisateur click sur "oui" a l'air de marcher.
Mais lorsqu'il click sur "non" cela fé toutes les actions de oui.
comment faire ?
Dois je metre if rep = bbYes
devant toutes les lignes ???
======================================================
Sub annulprog()
rep = MsgBox("Etes vous sur de vouloir suprimer toutes vos actions, et de commencer un nouveau portefeuille ?", vbYesNo)
If rep = vbYes Then Sheets("action 1").Select
Range("A19").Select
ActiveCell.FormulaR1C1 = "1"
Range("H38").Select
ActiveCell.FormulaR1C1 = "0"
Range("H39").Select
ActiveCell.FormulaR1C1 = "0"
Range("H40").Select
Sheets("action 2").Select
Range("A19").Select
ActiveCell.FormulaR1C1 = "1"
Range("H38").Select
ActiveCell.FormulaR1C1 = "0"
Range("H39").Select
ActiveCell.FormulaR1C1 = "0"
Range("H40").Select
Sheets("action 3").Select
Range("A19").Select
ActiveCell.FormulaR1C1 = "1"
Range("H38").Select
ActiveCell.FormulaR1C1 = "0"
Range("H39").Select
ActiveCell.FormulaR1C1 = "0"
Range("H40").Select
Sheets("action 4").Select
Range("A19").Select
ActiveCell.FormulaR1C1 = "1"
Range("H38").Select
ActiveCell.FormulaR1C1 = "0"
Range("H39").Select
ActiveCell.FormulaR1C1 = "0"
Range("H40").Select
Sheets("action 5").Select
Range("A19").Select
ActiveCell.FormulaR1C1 = "1"
Range("H38").Select
ActiveCell.FormulaR1C1 = "0"
Range("H39").Select
ActiveCell.FormulaR1C1 = "0"
Range("H40").Select
Sheets("action 6").Select
Range("A19").Select
ActiveCell.FormulaR1C1 = "1"
Range("H38").Select
ActiveCell.FormulaR1C1 = "0"
Range("H39").Select
ActiveCell.FormulaR1C1 = "0"
Range("H40").Select
Sheets("action 7").Select
Range("A19").Select
ActiveCell.FormulaR1C1 = "1"
Range("H38").Select
ActiveCell.FormulaR1C1 = "0"
Range("H39").Select
ActiveCell.FormulaR1C1 = "0"
Range("H40").Select
Sheets("action 8").Select
Range("A19").Select
ActiveCell.FormulaR1C1 = "1"
Range("H38").Select
ActiveCell.FormulaR1C1 = "0"
Range("H39").Select
ActiveCell.FormulaR1C1 = "0"
Range("H40").Select
Sheets("action 9").Select
Range("A19").Select
ActiveCell.FormulaR1C1 = "1"
Range("H38").Select
ActiveCell.FormulaR1C1 = "0"
Range("H39").Select
ActiveCell.FormulaR1C1 = "0"
Range("H40").Select
Sheets("action 10").Select
Range("A19").Select
ActiveCell.FormulaR1C1 = "1"
Range("H38").Select
ActiveCell.FormulaR1C1 = "0"
Range("H39").Select
ActiveCell.FormulaR1C1 = "0"
Sheets("page principale").Select
If rep = vbYes Then MsgBox "le programme a été réinitialisé"
If rep = vbNo Then MsgBox "Le programme n'a pas été reinitialisé."
End Sub
=====================================================
J'ai un petit probleme avec ma maccro.
La condition si l'utilisateur click sur "oui" a l'air de marcher.
Mais lorsqu'il click sur "non" cela fé toutes les actions de oui.
comment faire ?
Dois je metre if rep = bbYes
devant toutes les lignes ???
======================================================
Sub annulprog()
rep = MsgBox("Etes vous sur de vouloir suprimer toutes vos actions, et de commencer un nouveau portefeuille ?", vbYesNo)
If rep = vbYes Then Sheets("action 1").Select
Range("A19").Select
ActiveCell.FormulaR1C1 = "1"
Range("H38").Select
ActiveCell.FormulaR1C1 = "0"
Range("H39").Select
ActiveCell.FormulaR1C1 = "0"
Range("H40").Select
Sheets("action 2").Select
Range("A19").Select
ActiveCell.FormulaR1C1 = "1"
Range("H38").Select
ActiveCell.FormulaR1C1 = "0"
Range("H39").Select
ActiveCell.FormulaR1C1 = "0"
Range("H40").Select
Sheets("action 3").Select
Range("A19").Select
ActiveCell.FormulaR1C1 = "1"
Range("H38").Select
ActiveCell.FormulaR1C1 = "0"
Range("H39").Select
ActiveCell.FormulaR1C1 = "0"
Range("H40").Select
Sheets("action 4").Select
Range("A19").Select
ActiveCell.FormulaR1C1 = "1"
Range("H38").Select
ActiveCell.FormulaR1C1 = "0"
Range("H39").Select
ActiveCell.FormulaR1C1 = "0"
Range("H40").Select
Sheets("action 5").Select
Range("A19").Select
ActiveCell.FormulaR1C1 = "1"
Range("H38").Select
ActiveCell.FormulaR1C1 = "0"
Range("H39").Select
ActiveCell.FormulaR1C1 = "0"
Range("H40").Select
Sheets("action 6").Select
Range("A19").Select
ActiveCell.FormulaR1C1 = "1"
Range("H38").Select
ActiveCell.FormulaR1C1 = "0"
Range("H39").Select
ActiveCell.FormulaR1C1 = "0"
Range("H40").Select
Sheets("action 7").Select
Range("A19").Select
ActiveCell.FormulaR1C1 = "1"
Range("H38").Select
ActiveCell.FormulaR1C1 = "0"
Range("H39").Select
ActiveCell.FormulaR1C1 = "0"
Range("H40").Select
Sheets("action 8").Select
Range("A19").Select
ActiveCell.FormulaR1C1 = "1"
Range("H38").Select
ActiveCell.FormulaR1C1 = "0"
Range("H39").Select
ActiveCell.FormulaR1C1 = "0"
Range("H40").Select
Sheets("action 9").Select
Range("A19").Select
ActiveCell.FormulaR1C1 = "1"
Range("H38").Select
ActiveCell.FormulaR1C1 = "0"
Range("H39").Select
ActiveCell.FormulaR1C1 = "0"
Range("H40").Select
Sheets("action 10").Select
Range("A19").Select
ActiveCell.FormulaR1C1 = "1"
Range("H38").Select
ActiveCell.FormulaR1C1 = "0"
Range("H39").Select
ActiveCell.FormulaR1C1 = "0"
Sheets("page principale").Select
If rep = vbYes Then MsgBox "le programme a été réinitialisé"
If rep = vbNo Then MsgBox "Le programme n'a pas été reinitialisé."
End Sub
=====================================================