probleme not nothing ou nothing
Bonsoir,
j'ai copié ce bout de code sur le forum :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| Sub essai()
'ne pas faire attention aux variables inutiles
Dim debut, Noligne
Dim Cell As Range, x As Integer, y As Integer, z As Integer, plage As Range, ayant_droit As Range, statut As String
y = 40
statut = "RETRAITE"
With Worksheets("AYANTS DROIT")
Set ayant_droit = .Range("d8:d" & .Range("d1000").End(xlUp).Row)
Set Cell = ayant_droit.Find(statut, LookIn:=xlValues)
If Not Cell Is Nothing Then
debut = Cell.Row
Do
Sheets("recap").Range("a" & y) = .Range("b" & Cell.Row)
y = y + 1
Noligne = Cell.Row
'...
'
Set Cell = ayant_droit.FindNext(Cell)
Loop While Not Cell Is Nothing And Cell.Row <> debut
End If
End With
End Sub |
il marche bien mais quand je veux selectionner toutes les cellules diffrentes de "RETRAITE" (dans la variable statut), j'essaie avec :
Code:
If Cell Is Nothing Then
au lieu de
Code:
If Not Cell Is Nothing Then
et ca ne marche pas, mon résultat est nul
comment puis-je contourner le problème sachant que les autres choix de sélections sont nombreux
Merci d'avance de votre réponse