Run time-error '424': object required

Fermé
adam Guerre-genton - 6 juin 2014 à 11:10
sipherion Messages postés 1798 Date d'inscription lundi 22 octobre 2007 Statut Membre Dernière intervention 19 décembre 2016 - 6 juin 2014 à 14:09
Bonjour
Je bloque actuellement car mon code n'arrive pas a detecter ce qu'il y a dans mes cellules je cherche ici a suprimer les lignes dont la case ne contient pas de "V"
voici mon code:

Sub Classify():
Dim i As Integer
Dim a As String
For i = 4 To 100
a = worksheet1.Cells(i, 11).Value
If InStr([1], [V], a) = 0 Then
Rows("i:11").Select
Selection.Delete Shift:=xlUp
End If
Next i
End Sub

mon code me renvoit l'erreur 424, j'en ai deduis que lorsque j'essaye de lui donner la chaine de caractere dans a il ne l'a prend pas et je sais pas pourquoi vous pouvez m'aider ?

Merci d'avance
Adam
A voir également:

2 réponses

f894009 Messages postés 17185 Date d'inscription dimanche 25 novembre 2007 Statut Membre Dernière intervention 15 avril 2024 1 702
6 juin 2014 à 13:57
Bonjour,

Sub Classify()
Dim i As Integer

Application.ScreenUpdating = False
For i = 40 To 4 Step -1
If InStr(1, Worksheets("feuil1").Cells(i, 1).Value, "V") = 0 Then
Rows(i).Delete
End If
Next i
Application.ScreenUpdating = True
End Sub
'ou

Sub Classify_1()
Dim i As Integer

Application.ScreenUpdating = False
For i = 40 To 4 Step -1
If Not (Worksheets("feuil1").Cells(i, 1).Value Like "*" & "V" & "*") Then
Rows(i).Delete
End If
Next i
Application.ScreenUpdating = True
End Sub
0
sipherion Messages postés 1798 Date d'inscription lundi 22 octobre 2007 Statut Membre Dernière intervention 19 décembre 2016 285
6 juin 2014 à 14:09
Bonjour,


Sub Classify()

Dim i As Integer
Dim a As String
Dim b As Integer

For i = 4 To 100
a = Sheets(1).Cells(i, 11).Value
If a = "" Then Exit For
b = InStr(a, "V")
If b = 0 Then
Rows(i).Select
Selection.Delete Shift:=xlUp
i = i - 1
End If
Next i

End Sub
0