Autres simplifier un code (RESOLU)

Boostez vos compétences Excel avec notre communauté !

Rejoignez Excel Downloads, le rendez-vous des passionnés où l'entraide fait la force. Apprenez, échangez, progressez – et tout ça gratuitement ! 👉 Inscrivez-vous maintenant !

chaelie2015

XLDnaute Accro
Bonjour Forum
je souhaite simplifier ce code ( si c'est possible)
VB:
Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Shapes("valider").Visible = False

If Range("f5") <> "" And Range("f7") <> "" And Range("f9") <> "" And Range("f11") <> "" And Range("f13") <> "" And Range("f15") <> "" And Range("f17") <> "" Then
ActiveSheet.Shapes("valider").Visible = True
End If
 
End Sub
merci par avance
 
Bonjour Chaelie,
Juste une idée :
VB:
Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Shapes("valider").Visible = False
If [F5] & [F7] & [F9] & [F11] & [F13] & [F15] & [F17] <> "" Then ActiveSheet.Shapes("valider").Visible = True
End Sub
car si chaque cellule est vide alors la concaténation sera vide.
 
Bonjour Forum
je souhaite simplifier ce code ( si c'est possible)
VB:
Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Shapes("valider").Visible = False

If Range("f5") <> "" And Range("f7") <> "" And Range("f9") <> "" And Range("f11") <> "" And Range("f13") <> "" And Range("f15") <> "" And Range("f17") <> "" Then
ActiveSheet.Shapes("valider").Visible = True
End If

End Sub
merci par avance
Bonjour à tous
Essaye
VB:
Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Shapes("valider").Visible = Range("f5") <> "" And Range("f7") <> "" And Range("f9") <> "" And Range("f11") <> "" And Range("f13") <> "" And Range("f15") <> "" And Range("f17") <> ""
End Sub

Selon ce qu'il y a dans les cellules f6, f8, f10, f12, f14, f16 on pourrait simplifier avec
Code:
ActiveSheet.Shapes("valider").Visible = Application.CountIf([f5:f17], "") < 7
 
Dernière édition:
- Navigue sans publicité
- Accède à Cléa, notre assistante IA experte Excel... et pas que...
- Profite de fonctionnalités exclusives
Ton soutien permet à Excel Downloads de rester 100% gratuit et de continuer à rassembler les passionnés d'Excel.
Je deviens Supporter XLD

Discussions similaires

Réponses
7
Affichages
106
  • Question Question
Microsoft 365 worksheet_change
Réponses
29
Affichages
250
Réponses
1
Affichages
322
  • Question Question
Microsoft 365 Probléme VBA
Réponses
8
Affichages
233
Réponses
2
Affichages
129
Retour