OK modifications faites voir ci-dessous le code complet mais cette fois il me marque l'anomalie :
Erreur de compilation : For sans Next
Code complet :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| Private Sub CommandButton1_Click()
Dim Wb As Workbook
Feuil1.Select 'Feuil1(nom de gauche en projet)
Chemin = "G:\S - ISO\"
Fichier = TextBox1.Text & ".xls"
On Error Resume Next
Set Wb = GetObject(Chemin & Fichier)
If Err <> 0 Then MsgBox "Fichier Absent": Exit Sub
Workbooks.Open (fichierAOuvrir)
Set Wb = ActiveWorkbook
Windows(WbPrincipal.Name).Activate
With Wb.Sheets("Feuil1")
For k = 10 To .[A65536].End(3).Row
If .Range("A" & k) <> "" Then
lig = [I65536].End(3).Row + 1
If Range("W10").Value = "" And Range("U10").Value < Date Then GoTo extract
If Range("AD10").Value = "" And Range("AA10").Value < Date Then GoTo extract
Exit Sub
End If
extract:
Range("D" & lig).Value = .Range("T" & k).Value
Range("F" & lig).Value = .Range("A" & k).Value
Range("G" & lig).Value = .Range("G" & k).Value
Range("H" & lig).Value = .Range("P" & k).Value
Range("I" & lig).Value = .Range("M" & k).Value
Range("J" & lig).Value = .Range("H" & k).Value
Range("J" & lig).Value = .Range("O" & k).Value
End Sub |
Partager