Bonjour,
Je voudrai extraire des données issues d'un fichier (Plan d'action SMQ) vers un autre (Tableau de suivi actions) et celà sous certaines conditions (je joins le fichier word explicatif).
J'ai rédigé ce code mais je pense qu'il ne fonctionnera pas. Pouvez-vous m'aider ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
30
31
32
33
34
35 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 = "" Then If Range("U10").Value < aujourdhui() Then GoTo extract End If End If If Range("AD10").Value = "" Then If Range("AA10").Value < aujourdhui() Then GoTo extract End If End If Exit Sub 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 If Next
Partager