Bonjour,
Est ce que quelqu'un pourrait jeter un coup d’œil sur ma macro, je ne comprend pas pourquoi elle tourne en rond (elle ne s’arrête pas).
Si quelqu'un peut m'aider il me sauvera la vie
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68 Sub BenchTest() ' ' Macro2 Macro ' Dim hotel As String, TourOP As String, station As String Dim I As Long, j As Long, nbrelig As Long Dim X As String Application.ScreenUpdating = False Application.DisplayAlerts = False Sheets("Feuil6").Select nbrelig = Application.WorksheetFunction.CountA(Columns(1)) For j = 2 To nbrelig hotel = Sheets("Feuil6").Range("B" & j).Value TourOP = Sheets("Feuil6").Range("A" & j).Value station = Sheets("Feuil6").Range("LK" & j).Value For I = 1 To 160 Sheets("RECAP").Range("A" & I + 160 * (j - 2)).Value = hotel Sheets("RECAP").Range("B" & I + 160 * (j - 2)).Value = TourOP Sheets("RECAP").Range("C" & I + 160 * (j - 2)).Value = station Sheets("Feuil6").Select Range(Cells(j, 2 * I + 1), Cells(j, 2 * I + 2)).Copy Sheets("RECAP").Select Range("D" & I + 160 * (j - 2)).Select ActiveSheet.Paste Next I Next j Columns("A:G").Select Application.CutCopyMode = False ActiveWorkbook.Worksheets("RECAP").Sort.SortFields.Clear ActiveWorkbook.Worksheets("RECAP").Sort.SortFields.Add Key:=Range("F1:F15840" _ ), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal With ActiveWorkbook.Worksheets("RECAP").Sort .SetRange Range("A1:G15840") .Header = xlGuess .MatchCase = False .Orientation = xlTopToBottom .SortMethod = xlPinYin .Apply End With If Err.Number <> 0 Then Sheets("RECAP").Select Range("J8").Select ActiveCell.Value = "Erreur de mise à jour" Else Sheets("RECAP").Select Range("J8").Select ActiveCell.Value = Now End If DoEvents ActiveWorkbook.Save End Sub
Partager