Autres simplifier un code (RESOLU)

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
 

sylvanu

XLDnaute Barbatruc
Supporter XLD
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.
 

Jacky67

XLDnaute Barbatruc
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:

Statistiques des forums

Discussions
314 013
Messages
2 104 552
Membres
109 078
dernier inscrit
Nikitoklass