Run time-error '424': object required

adam Guerre-genton -  
sipherion Messages postés 1836 Date d'inscription   Statut Membre Dernière intervention   -
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

2 réponses

  1. f894009 Messages postés 17417 Date d'inscription   Statut Membre Dernière intervention   1 717
     
    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
  2. sipherion Messages postés 1836 Date d'inscription   Statut Membre Dernière intervention   287
     
    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