Lancement automatique d'une macro
Bonjour,
Après avoir lu plusieurs discussion, je n'arrive toujours pas à réaliser mon lancement automatique de macro.
Je suis en train de créer un puissance 4 et ma macro permet de mettre les pions identique de la couleurs initialement choisi. Mais j'ai besoin que cela sa fasse automatiquement (sans cliquer sur un bouton)
Quelqu'un peut m'aider svp , je joins le fichier[
Merci d'avance pour votre aide
Bonjour et bienvenu
mets dans un module
Sub auto_open()
MaMacro
End Sub
Bonjour,
Merci .
J'ai essayé de mettre le code, mais cela ne fonctionne pas :/
Sub auto_open()
couleurpions
End Sub
Voici ma macro couleur pions :
Sub couleurpions()
If Range("A3").Value = Range("O5").Value Then
Range("A3").Font.color = Range("O5").Font.color
End If
If Range("A3").Value = Range("O6").Value Then
Range("A3").Font.color = Range("O6").Font.color
End If
If Range("A3").Value = Range("O7").Value Then
Range("A3").Font.color = Range("O7").Font.color
End If
If Range("A4").Value = Range("O5").Value Then
Range("A4").Font.color = Range("O5").Font.color
End If
If Range("A4").Value = Range("O6").Value Then
Range("A4").Font.color = Range("O6").Font.color
End If
If Range("A4").Value = Range("O7").Value Then
Range("A4").Font.color = Range("O7").Font.color
End If
If Range("A5").Value = Range("O5").Value Then
Range("A5").Font.color = Range("O5").Font.color
End If
If Range("A5").Value = Range("O6").Value Then
Range("A5").Font.color = Range("O6").Font.color
End If
If Range("A5").Value = Range("O7").Value Then
Range("A5").Font.color = Range("O7").Font.color
End If
If Range("A6").Value = Range("O5").Value Then
Range("A6").Font.color = Range("O5").Font.color
End If
If Range("A6").Value = Range("O6").Value Then
Range("A6").Font.color = Range("O6").Font.color
End If
If Range("A6").Value = Range("O7").Value Then
Range("A6").Font.color = Range("O7").Font.color
End If
If Range("A7").Value = Range("O5").Value Then
Range("A7").Font.color = Range("O5").Font.color
End If
If Range("A7").Value = Range("O6").Value Then
Range("A7").Font.color = Range("O6").Font.color
End If
If Range("A7").Value = Range("O7").Value Then
Range("A7").Font.color = Range("O7").Font.color
End If
If Range("B3").Value = Range("O5").Value Then
Range("B3").Font.color = Range("O5").Font.color
End If
If Range("b3").Value = Range("O6").Value Then
Range("b3").Font.color = Range("O6").Font.color
End If
If Range("b3").Value = Range("O7").Value Then
Range("b3").Font.color = Range("O7").Font.color
End If
If Range("b4").Value = Range("O5").Value Then
Range("b4").Font.color = Range("O5").Font.color
End If
If Range("b4").Value = Range("O6").Value Then
Range("b4").Font.color = Range("O6").Font.color
End If
If Range("b4").Value = Range("O7").Value Then
Range("b4").Font.color = Range("O7").Font.color
End If
If Range("b5").Value = Range("O5").Value Then
Range("b5").Font.color = Range("O5").Font.color
End If
If Range("b5").Value = Range("O6").Value Then
Range("b5").Font.color = Range("O6").Font.color
End If
If Range("b5").Value = Range("O7").Value Then
Range("b5").Font.color = Range("O7").Font.color
End If
If Range("b6").Value = Range("O5").Value Then
Range("b6").Font.color = Range("O5").Font.color
End If
If Range("b6").Value = Range("O6").Value Then
Range("b6").Font.color = Range("O6").Font.color
End If
If Range("b6").Value = Range("O7").Value Then
Range("b6").Font.color = Range("O7").Font.color
End If
If Range("b7").Value = Range("O5").Value Then
Range("b7").Font.color = Range("O5").Font.color
End If
If Range("B7").Value = Range("O6").Value Then
Range("B7").Font.color = Range("O6").Font.color
End If
If Range("b7").Value = Range("O7").Value Then
Range("b7").Font.color = Range("O7").Font.color
End If
If Range("c3").Value = Range("O5").Value Then
Range("c3").Font.color = Range("O5").Font.color
End If
If Range("c3").Value = Range("O6").Value Then
Range("c3").Font.color = Range("O6").Font.color
End If
If Range("c3").Value = Range("O7").Value Then
Range("c3").Font.color = Range("O7").Font.color
End If
If Range("c4").Value = Range("O5").Value Then
Range("c4").Font.color = Range("O5").Font.color
End If
If Range("c4").Value = Range("O6").Value Then
Range("c4").Font.color = Range("O6").Font.color
End If
If Range("c4").Value = Range("O7").Value Then
Range("c4").Font.color = Range("O7").Font.color
End If
If Range("c5").Value = Range("O5").Value Then
Range("c5").Font.color = Range("O5").Font.color
End If
If Range("c5").Value = Range("O6").Value Then
Range("c5").Font.color = Range("O6").Font.color
End If
If Range("c5").Value = Range("O7").Value Then
Range("c5").Font.color = Range("O7").Font.color
End If
If Range("c6").Value = Range("O5").Value Then
Range("c6").Font.color = Range("O5").Font.color
End If
If Range("c6").Value = Range("O6").Value Then
Range("c6").Font.color = Range("O6").Font.color
End If
If Range("c6").Value = Range("O7").Value Then
Range("c6").Font.color = Range("O7").Font.color
End If
If Range("c7").Value = Range("O5").Value Then
Range("c7").Font.color = Range("O5").Font.color
End If
If Range("c7").Value = Range("O6").Value Then
Range("c7").Font.color = Range("O6").Font.color
End If
If Range("c7").Value = Range("O7").Value Then
Range("c7").Font.color = Range("O7").Font.color
End If
If Range("d3").Value = Range("O5").Value Then
Range("d3").Font.color = Range("O5").Font.color
End If
If Range("d3").Value = Range("O6").Value Then
Range("d3").Font.color = Range("O6").Font.color
End If
If Range("d3").Value = Range("O7").Value Then
Range("d3").Font.color = Range("O7").Font.color
End If
If Range("d4").Value = Range("O5").Value Then
Range("d4").Font.color = Range("O5").Font.color
End If
If Range("d4").Value = Range("O6").Value Then
Range("d4").Font.color = Range("O6").Font.color
End If
If Range("d4").Value = Range("O7").Value Then
Range("d4").Font.color = Range("O7").Font.color
End If
If Range("d5").Value = Range("O5").Value Then
Range("d5").Font.color = Range("O5").Font.color
End If
If Range("d5").Value = Range("O6").Value Then
Range("d5").Font.color = Range("O6").Font.color
End If
If Range("d5").Value = Range("O7").Value Then
Range("d5").Font.color = Range("O7").Font.color
End If
If Range("d6").Value = Range("O5").Value Then
Range("d6").Font.color = Range("O5").Font.color
End If
If Range("d6").Value = Range("O6").Value Then
Range("d6").Font.color = Range("O6").Font.color
End If
If Range("d6").Value = Range("O7").Value Then
Range("d6").Font.color = Range("O7").Font.color
End If
If Range("d7").Value = Range("O5").Value Then
Range("d7").Font.color = Range("O5").Font.color
End If
If Range("d7").Value = Range("O6").Value Then
Range("d7").Font.color = Range("O6").Font.color
End If
If Range("d7").Value = Range("O7").Value Then
Range("d7").Font.color = Range("O7").Font.color
End If
If Range("e3").Value = Range("O5").Value Then
Range("e3").Font.color = Range("O5").Font.color
End If
If Range("e3").Value = Range("O6").Value Then
Range("e3").Font.color = Range("O6").Font.color
End If
If Range("e3").Value = Range("O7").Value Then
Range("e3").Font.color = Range("O7").Font.color
End If
If Range("e4").Value = Range("O5").Value Then
Range("e4").Font.color = Range("O5").Font.color
End If
If Range("e4").Value = Range("O6").Value Then
Range("e4").Font.color = Range("O6").Font.color
End If
If Range("e4").Value = Range("O7").Value Then
Range("e4").Font.color = Range("O7").Font.color
End If
If Range("e5").Value = Range("O5").Value Then
Range("e5").Font.color = Range("O5").Font.color
End If
If Range("e5").Value = Range("O6").Value Then
Range("e5").Font.color = Range("O6").Font.color
End If
If Range("e5").Value = Range("O7").Value Then
Range("e5").Font.color = Range("O7").Font.color
End If
If Range("e6").Value = Range("O5").Value Then
Range("e6").Font.color = Range("O5").Font.color
End If
If Range("e6").Value = Range("O6").Value Then
Range("e6").Font.color = Range("O6").Font.color
End If
If Range("e6").Value = Range("O7").Value Then
Range("e6").Font.color = Range("O7").Font.color
End If
If Range("e7").Value = Range("O5").Value Then
Range("e7").Font.color = Range("O5").Font.color
End If
If Range("e7").Value = Range("O6").Value Then
Range("e7").Font.color = Range("O6").Font.color
End If
If Range("e7").Value = Range("O7").Value Then
Range("e7").Font.color = Range("O7").Font.color
End If
If Range("f3").Value = Range("O5").Value Then
Range("f3").Font.color = Range("O5").Font.color
End If
If Range("f3").Value = Range("O6").Value Then
Range("f3").Font.color = Range("O6").Font.color
End If
If Range("f3").Value = Range("O7").Value Then
Range("f3").Font.color = Range("O7").Font.color
End If
If Range("f4").Value = Range("O5").Value Then
Range("f4").Font.color = Range("O5").Font.color
End If
If Range("f4").Value = Range("O6").Value Then
Range("f4").Font.color = Range("O6").Font.color
End If
If Range("f4").Value = Range("O7").Value Then
Range("f4").Font.color = Range("O7").Font.color
End If
If Range("f5").Value = Range("O5").Value Then
Range("f5").Font.color = Range("O5").Font.color
End If
If Range("f5").Value = Range("O6").Value Then
Range("f5").Font.color = Range("O6").Font.color
End If
If Range("f5").Value = Range("O7").Value Then
Range("f5").Font.color = Range("O7").Font.color
End If
If Range("f6").Value = Range("O5").Value Then
Range("f6").Font.color = Range("O5").Font.color
End If
If Range("f6").Value = Range("O6").Value Then
Range("f6").Font.color = Range("O6").Font.color
End If
If Range("f6").Value = Range("O7").Value Then
Range("f6").Font.color = Range("O7").Font.color
End If
If Range("f7").Value = Range("O5").Value Then
Range("f7").Font.color = Range("O5").Font.color
End If
If Range("f7").Value = Range("O6").Value Then
Range("f7").Font.color = Range("O6").Font.color
End If
If Range("f7").Value = Range("O7").Value Then
Range("f7").Font.color = Range("O7").Font.color
End If
End Sub
Dans tous les cas, cette commande lance bien en auto la macro
Dis moi si au lancement tu a bien le message "on y va" ?
C'est bon j'ai trouvé par :
Sub private worksheet_change (byval target as range)
ma macro
End sub
MErci =)