Problème avec différents boutons en VBA
Bonjour à toutes et à tous,
Voilà j'utilise des userforms mais j'ai un petit souci. J'ai 3 boutons dans un 1er userform. J'aimerai que le choix du bouton soit pris en compte et que l'une des cellules de ma feuille 1 soit modifiée en fonction du choix du bouton.
J'ai essayé ceci mais le clic sur l'un des bouton n'affecte rien.
Code:
1 2 3 4 5 6 7 8 9
| If userform4.CommandButton1 = True Then
Sheets("feuil1").Range("A2").Value = Sheets("feuil1").Range("A2").Value - Sheets("feuil2").Range("B2").Value
End If
If userform4.CommandButton2 = True Then
Sheets("feuil1").Range("A3").Value = Sheets("feuil1").Range("A3").Value - Sheets("feuil2").Range("B2").Value
End If
If userform4.CommandButton3 = True Then
Sheets("feuil1").Range("A4").Value = Sheets("feuil1").Range("A4").Value - Sheets("feuil2").Range("B2").Value
End If |
L'utilisation d'une variable serait peut-être l'une des solution mais je ne sais où l'utiliser.
Merci d'avance pour votre aide.
Cordialement