Re : blocage macro par recalcul
etape 3 on range tous dans une feuille et on met les formules adequates:
ws2.Select
Dim derligne1%, derligne2%
Dim i1%, i2%
derligne1 = Sheets("Conso_Dpt").Range("D65536").End(xlUp).Row
derligne2 = ws2.Range("p65536").End(xlUp).Row
For i2 = 1 To derligne2
For i1 = 14 To derligne1
If Sheets("Conso_Dpt").Range("D" & i1) = ws2.Range("p" & i2) Then
Exist = 1
GoTo Suivant
End If
Next
If Exist = 1 Then GoTo Suivant
Sheets("Conso_Dpt").Range("D" & derligne1 + 1) = ws2.Range("p" & i2)
derligne1 = Sheets("Conso_Dpt").Range("D65536").End(xlUp).Row
Suivant:
Exist = 0
Next
Sheets("Conso_Dpt").Select
Rows(13).Hidden = False
derligne1 = Range("E65536").End(xlUp).Row
derligne2 = Range("D65536").End(xlUp).Row
Range("A13:C13").Copy
Range(Cells(derligne2 + 1, 1), Cells(derligne1 + 1, 5)).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Range("E13:GF13").Copy
Range(Cells(derligne2 + 1, 7), Cells(derligne1 + 1, 188)).Select
ActiveSheet.Paste
Application.CutCopyMode = False
Rows(13).Hidden = True
Sheets("Conso_Dpt").Select
Calculate
Range("A14:GF1000").Select
Selection.Copy
Range("A14:GF1000").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Sheets("Conso_Dpt").Select
Range("A14😀O10000").Select
Selection.Sort Key1:=Range("B14"), key2:=Range("E14"), key3:=Range("G14"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
ws2.Visible = False
Application.ScreenUpdating = True
Sheets("Conso_Dpt").Select
Application.DisplayAlerts = False
Range(Cells(13, 1), Cells(derligne2 + 2, 200)).Select
Selection.Subtotal GroupBy:=2, Function:=xlSum, TotalList:=Array(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, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, _
90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, _
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131 _
, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, _
151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170 _
, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188), _
Replace:=False, PageBreaks:=False, SummaryBelowData:=True
derligne2 = Range("D65536").End(xlUp).Row
Range(Cells(13, 1), Cells(derligne2 + 2, 200)).Select
Selection.Subtotal GroupBy:=5, Function:=xlSum, TotalList:=Array(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, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, _
90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, _
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131 _
, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, _
151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170 _
, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188), _
Replace:=False, PageBreaks:=False, SummaryBelowData:=True
derligne2 = Range("D65536").End(xlUp).Row
Range(Cells(13, 1), Cells(derligne2 + 2, 200)).Select
Selection.Subtotal GroupBy:=7, Function:=xlSum, TotalList:=Array(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, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, _
90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, _
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131 _
, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, _
151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170 _
, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188), _
Replace:=False, PageBreaks:=False, SummaryBelowData:=True
Application.DisplayAlerts = True
End Sub
merci pour ceux qui auront le courage de lire.
et merci à ceux aussi qui ne l'auront pas