Bonjour à tous,
mon premier message - youhouu !!!
Jusqu'ici je savais me dépatouiller en autoditacte un peu en piochant ça et la des solutions à mes petits soucis sur ce forum. D'ailleurs merci à tous ceux qui partagent leur savoir.
Voilà, mon problème actuel est que je bloque sur une macro. et que je ne trouve pas où est l'erreur. je n'arrive pas à joindre de fichiers, dossier très lourd, désolé. je post ci dessous un max d'info.
Merci d'avance à qui pourra m'aider.
Voici les codes :
Private Sub Image1_Click()
Dim Lg As Long
Dim FDep As String
Dim FFin As String
Dim J As Long
Dim titre As Boolean
Dim LgFin As Long
Dim Critere As String
FDep = "A Echanger"
FFin = "Analyse"
Lg = 3
Sheets(FFin).Range("a2:N65536").ClearContents
With Sheets(FDep)
Critere = UCase(Sheets(FFin).Range("a1"))
If Critere = "" Then Exit Sub
For J = 2 To .Range("A65536").End(xlUp).Row
If UCase(.Cells(J, 1)) = Critere Then
If titre = False Then
.Range("A1:m1").Copy Destination:=Sheets(FFin).Range("A2")
titre = True
End If
.Range(.Cells(J, 1), .Cells(J, 22)).Copy Destination:=Sheets(FFin).Cells(Lg, 1)
Lg = Lg + 1
End If
Next J
End With
Unload Me
End Sub
Private Sub Image2_Click()
Dim Lg As Long
Dim FDep As String
Dim FFin As String
Dim J As Long
Dim titre As Boolean
Dim LgFin As Long
Dim Critere As String
FDep = "A Echanger"
FFin = "Analyse"
Lg = 3
Sheets(FFin).Range("a2:N65536").ClearContents
With Sheets(FDep)
Critere = UCase(Sheets(FFin).Range("a1"))
If Critere = "" Then Exit Sub
For J = 2 To .Range("A65536").End(xlUp).Row
If UCase(.Cells(J, 14)) = Critere Then
If titre = False Then
.Range("A1:n1").Copy Destination:=Sheets(FFin).Range("A2")
titre = True
End If
.Range(.Cells(J, 1), .Cells(J, 22)).Copy Destination:=Sheets(FFin).Cells(Lg, 1)
Lg = Lg + 1
End If
Next J
End With
Unload Me
End Sub
Celui de l'image 1 fonctionne parfaitement, mais pas celui de l'image 2.
Type d'info récuperer :
pour image 1 : H. EDOUARD HERRIOT - PAV. G
pour image 2 : DMP - DEFESE Jean-Pierre
lors du débogage, vba m'indique cette ligne dans image 2 :
If UCase(.Cells(J, 14)) = Critere Then
mon premier message - youhouu !!!
Jusqu'ici je savais me dépatouiller en autoditacte un peu en piochant ça et la des solutions à mes petits soucis sur ce forum. D'ailleurs merci à tous ceux qui partagent leur savoir.
Voilà, mon problème actuel est que je bloque sur une macro. et que je ne trouve pas où est l'erreur. je n'arrive pas à joindre de fichiers, dossier très lourd, désolé. je post ci dessous un max d'info.
Merci d'avance à qui pourra m'aider.
Voici les codes :
Private Sub Image1_Click()
Dim Lg As Long
Dim FDep As String
Dim FFin As String
Dim J As Long
Dim titre As Boolean
Dim LgFin As Long
Dim Critere As String
FDep = "A Echanger"
FFin = "Analyse"
Lg = 3
Sheets(FFin).Range("a2:N65536").ClearContents
With Sheets(FDep)
Critere = UCase(Sheets(FFin).Range("a1"))
If Critere = "" Then Exit Sub
For J = 2 To .Range("A65536").End(xlUp).Row
If UCase(.Cells(J, 1)) = Critere Then
If titre = False Then
.Range("A1:m1").Copy Destination:=Sheets(FFin).Range("A2")
titre = True
End If
.Range(.Cells(J, 1), .Cells(J, 22)).Copy Destination:=Sheets(FFin).Cells(Lg, 1)
Lg = Lg + 1
End If
Next J
End With
Unload Me
End Sub
Private Sub Image2_Click()
Dim Lg As Long
Dim FDep As String
Dim FFin As String
Dim J As Long
Dim titre As Boolean
Dim LgFin As Long
Dim Critere As String
FDep = "A Echanger"
FFin = "Analyse"
Lg = 3
Sheets(FFin).Range("a2:N65536").ClearContents
With Sheets(FDep)
Critere = UCase(Sheets(FFin).Range("a1"))
If Critere = "" Then Exit Sub
For J = 2 To .Range("A65536").End(xlUp).Row
If UCase(.Cells(J, 14)) = Critere Then
If titre = False Then
.Range("A1:n1").Copy Destination:=Sheets(FFin).Range("A2")
titre = True
End If
.Range(.Cells(J, 1), .Cells(J, 22)).Copy Destination:=Sheets(FFin).Cells(Lg, 1)
Lg = Lg + 1
End If
Next J
End With
Unload Me
End Sub
Celui de l'image 1 fonctionne parfaitement, mais pas celui de l'image 2.
Type d'info récuperer :
pour image 1 : H. EDOUARD HERRIOT - PAV. G
pour image 2 : DMP - DEFESE Jean-Pierre
lors du débogage, vba m'indique cette ligne dans image 2 :
If UCase(.Cells(J, 14)) = Critere Then