Bonsoir à tous,
J'ai un petit souci avec une macro, un grand merci pour votre aide.
Je veux récupérer des données depuis un tableau croisé dynamique. Ma macro :
Ci-joint mon fichier Excel pour plus de détails.
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
36
37
38
39
40
41
42
43
44
45
46
47 Sub TRANSFERT() Dim i As Integer Dim a As Integer Dim b As Integer Dim valeur As String i = 3 Do Until Cells(i, 4) = "" valeur = Cells(i, 4) Cells(i, 5) = trouveIW(valeur, 3) 'Stock i = i + 1 Loop i = 3 a = 7 b = 4 Do Until Cells(i, 4) = "" valeur = Cells(i, 4) Cells(i, a) = trouveIW(valeur, b) 'Echu + 05S11 + 06S11 + 07S11 + 08S11 a = a + 1 b = b + 1 i = i + 1 Loop End Sub Function trouveIW(valeur As String, colonne As Integer) Dim j As Integer Dim trouve As String Sheets("TCD").Select j = 6 trouve = "" Do Until Cells(j, 1) = "" Or trouve <> "" If Cells(j, 1) = valeur Then trouve = Cells(j, colonne) End If j = j + 1 Loop trouveIW = trouve Sheets("Tableau").Select End Function
Merci encore
Partager