Salut BidExcel,
devrait faire le travail, je pense, d'après mes tests...
Un double-clic sur la feuille 'Valeurs_Cloture' démarre la macro.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
'
Dim tTab, iRow%, iCol%, sCol1$, iCol2$
'
Cancel = True
'
Application.ScreenUpdating = False
Application.Calculation = xlManual
'
tTab = Range("B3").Resize(Range("A" & Rows.Count).End(xlUp).Row - 2, Cells(3, Columns.Count).End(xlToLeft).Column - 1).Value
'
With Worksheets("RECAP")
iRow = .Range("A" & Rows.Count).End(xlUp).Row
iCol = .Cells(1, Columns.Count).End(xlToLeft).Column
.Range("A2").Resize(UBound(tTab, 2), UBound(tTab, 1)).FormulaLocal = WorksheetFunction.Transpose(tTab)
For x = 2 To iCol - 2
If sCol1 = "" Then sCol1 = .Cells(1, x)
If InStr(.Cells(1, x), "BRVM") > 0 Then _
sCol2 = .Cells(1, x - 1): _
.Range(fctCol(x) & 2).FormulaLocal = _
IIf(sCol1 = sCol2, "=[@" & sCol1 & "]", "=SOMME(Tableau5[@[" & sCol1 & "]:[" & sCol2 & "]])"): _
.Range(fctCol(x) & 2).AutoFill Destination:=.Range(fctCol(x) & "2:" & fctCol(x) & iRow): _
sCol1 = ""
Next
.Range(fctCol(iCol) & 2).FormulaLocal = _
"=SOMME.SI(Tableau5[[#En-têtes];[PALC]:[BRVM-TRP]];""BRVM*"";Tableau5[@[PALC]:[BRVM-TRP]])"
.Range(fctCol(iCol) & 2).AutoFill Destination:=.Range(fctCol(iCol) & "2:" & fctCol(iCol) & iRow)
End With
'
Application.Calculation = xlAutomatic
Application.ScreenUpdating = True
'
End Sub
A+