A voir également:
- VBA supprimer plusieurs lignes si condition
- Supprimer rond bleu whatsapp - Guide
- Supprimer une page word - Guide
- Supprimer pub youtube - Accueil - Streaming
- Fichier impossible à supprimer - Guide
- Supprimer compte instagram - Guide
3 réponses
Bonjour,
si tu veux mettre plusieurs instructions après ton Then, il te faut fermer ton If par un End If.
Cordialement.
si tu veux mettre plusieurs instructions après ton Then, il te faut fermer ton If par un End If.
Cordialement.
Merci de ton aide mais je dois encore faire une erreur, voilà ce que j'ai mis :
Sub Testaa()
Dim i%
For i = 25000 To 1 Step -1
If Cells(i, 4) = "System OK" And Cells(i, 7) = "phasing out" And Cells(i + 1, 4) = "Wind < start wind" And Cells(i + 1, 7) = "incoming" And Cells(i + 2, 4) = "Wind < start wind" And Cells(i + 2, 7) = "phasing out" And Cells(i + 3, 4) = "System OK" And Cells(i + 3, 7) = "incoming" Then Rows(i).Delete Rows(i + 1).Delete Rows(i + 2).Delete Rows(i + 3).Delete End If
Next
End Sub
Vois tu une erreur de syntaxe ?
Merci
Cordialement,
Sub Testaa()
Dim i%
For i = 25000 To 1 Step -1
If Cells(i, 4) = "System OK" And Cells(i, 7) = "phasing out" And Cells(i + 1, 4) = "Wind < start wind" And Cells(i + 1, 7) = "incoming" And Cells(i + 2, 4) = "Wind < start wind" And Cells(i + 2, 7) = "phasing out" And Cells(i + 3, 4) = "System OK" And Cells(i + 3, 7) = "incoming" Then Rows(i).Delete Rows(i + 1).Delete Rows(i + 2).Delete Rows(i + 3).Delete End If
Next
End Sub
Vois tu une erreur de syntaxe ?
Merci
Cordialement,
Je viens de résoudre mon problème, il s'agissait en fait que je n'écrivais pas les instructions sur plusieurs lignes, Voici le code fonctionnant :
Sub Testaa()
Dim i%
For i = 25000 To 1 Step -1
If Cells(i, 4) = "System OK" And Cells(i, 7) = "phasing out" And Cells(i + 1, 4) = "Wind < start wind" And Cells(i + 1, 7) = "incoming" And Cells(i + 2, 4) = "Wind < start wind" And Cells(i + 2, 7) = "phasing out" And Cells(i + 3, 4) = "System OK" And Cells(i + 3, 7) = "incoming" Then
Rows(i + 3).Delete
Rows(i + 2).Delete
Rows(i + 1).Delete
Rows(i).Delete
End If
Next
End Sub
Merci de ton aide
Cordialement,
Sub Testaa()
Dim i%
For i = 25000 To 1 Step -1
If Cells(i, 4) = "System OK" And Cells(i, 7) = "phasing out" And Cells(i + 1, 4) = "Wind < start wind" And Cells(i + 1, 7) = "incoming" And Cells(i + 2, 4) = "Wind < start wind" And Cells(i + 2, 7) = "phasing out" And Cells(i + 3, 4) = "System OK" And Cells(i + 3, 7) = "incoming" Then
Rows(i + 3).Delete
Rows(i + 2).Delete
Rows(i + 1).Delete
Rows(i).Delete
End If
Next
End Sub
Merci de ton aide
Cordialement,