Seddiki_adz
XLDnaute Impliqué
bonjour
j'ai besoin d'aide pour me corriger
j'ai un code de transfert mais ne fonctionne pas
Merci
le code
Sub CpyData()
If ActiveSheet.Name <> "Feuil1" Then Exit Sub
Dim cel As Range, nlm&, cnd1$, cnd2$, n1&, n2&, i&, j&: nlm = Rows.Count
With Worksheets("Feuil2")
n1 = Cells(nlm, 2).End(3).Row: If n1 = 10 Then Exit Sub
Do
cnd1 = InputBox("Lettre de la condition :", "Condition")
If cnd1 = "" Then Exit Sub 'condition non indiquée => quitter la sub
Loop Until cnd1 <> ""
n2 = .Cells(nlm, 2).End(3).Row: j = 12: Application.ScreenUpdating = 0
If n2 > 11 Then .Range("B12:H" & n2).ClearContents
For i = 12 To n1
Set cel = Cells(i, 2): cnd2 = cel.Offset(, 9)
If cnd2 = cnd1 Then
With .Cells(j, 2)
.Value = cel 'B : NOM
.Offset(, 1) = cel.Offset(, 1) 'C : PRENOM
.Offset(, 2) = cel.Offset(, 3) 'D : PROFESSION
.Offset(, 3) = cel.Offset(, 2) 'E : ETABLISSEMENT
.Offset(, 4) = cel.Offset(, 6) 'F : REGION
.Offset(, 5) = cel.Offset(, 8) 'G : OBS
j = j + 1
End With
End If
Next i
.Select
End With
End Sub
j'ai besoin d'aide pour me corriger
j'ai un code de transfert mais ne fonctionne pas
Merci
le code
Sub CpyData()
If ActiveSheet.Name <> "Feuil1" Then Exit Sub
Dim cel As Range, nlm&, cnd1$, cnd2$, n1&, n2&, i&, j&: nlm = Rows.Count
With Worksheets("Feuil2")
n1 = Cells(nlm, 2).End(3).Row: If n1 = 10 Then Exit Sub
Do
cnd1 = InputBox("Lettre de la condition :", "Condition")
If cnd1 = "" Then Exit Sub 'condition non indiquée => quitter la sub
Loop Until cnd1 <> ""
n2 = .Cells(nlm, 2).End(3).Row: j = 12: Application.ScreenUpdating = 0
If n2 > 11 Then .Range("B12:H" & n2).ClearContents
For i = 12 To n1
Set cel = Cells(i, 2): cnd2 = cel.Offset(, 9)
If cnd2 = cnd1 Then
With .Cells(j, 2)
.Value = cel 'B : NOM
.Offset(, 1) = cel.Offset(, 1) 'C : PRENOM
.Offset(, 2) = cel.Offset(, 3) 'D : PROFESSION
.Offset(, 3) = cel.Offset(, 2) 'E : ETABLISSEMENT
.Offset(, 4) = cel.Offset(, 6) 'F : REGION
.Offset(, 5) = cel.Offset(, 8) 'G : OBS
j = j + 1
End With
End If
Next i
.Select
End With
End Sub
Pièces jointes
Dernière édition: