Je souhaiterai faire apparitre un boutton dans un UF. en effet, mon UF se compose de la facon suivante:
2 optionboutton(s)
1 commandeboutton_click
Je souhaiterai que si les deux optionboutton sont vides, alors le bouttoncommande est invisible et que des que l'un des deux est activé, le boutton commande est visible.
Pur cela, jai tapé le code suivant mais le boutton commande est toujours activé:
Private Sub UserForm_initialize()
If OptionButton1.Value = "" And OptionButton2.Value = "" Then
CommandButton2.Visible = False
CommandButton2.Visible = True
End If
End Sub
Pouvez vous m'aider et m'expliquer ce qui ne va pas???
Bonjour Fabrice
essayer comme ceci mais je ne suis sur de rien
If OptionButton1.Value = "" And OptionButton2.Value = "" Then
CommandButton2.Visible = False
CommandButton2.Visible = True
Else
CommandButton1.Visible = False
End If
J'ai essayé de compliquer un peu la chose en rajoutant un 3eme option boutton.
J'ai essayé plusieurs formules a partir de la précédente maisc elle qui me semblait la plus juste ne marche pas.
Est- ce que quelqu'un peut m'aider???
Voila la formule que j'ai tapée:
Private Sub OptionButton1_Click()
If OptionButton1.Value = True Then
CommandButton2.Visible = True And CommandButton3.Visible = True
Else
CommandButton2.Visible = False And CommandButton3.Visible = False
End If
End Sub
Private Sub OptionButton2_Click()
If OptionButton2.Value = True Then
CommandButton1.Visible = True And CommandButton3.Visible = True
Else
CommandButton1.Visible = False And CommandButton3.Visible = False
End If
End Sub
Private Sub OptionButton3_Click()
If OptionButton3.Value = True Then
CommandButton1.Visible = True And CommandButton2.Visible = True
Else
CommandButton1.Visible = False And CommandButton2.Visible = False
End If
End Sub
Ca me paraissait logique, mais excel et moi ne devons pas avoir la meme logique lol ;=)