Function Vente(centre$, produit$)
Application.Volatile
Dim num As Byte, w As Worksheet, lig&, col%, cc%
centre = Replace(centre, " ", "") 'suppression des espaces
produit = Trim(Replace(produit, "Produit", "")) 'uniquement la lettre
num = Val(StrReverse(centre))
For Each w In Worksheets
If IsNumeric(w.Name) And w.Range("V5") = num Then
lig = Val(CStr(Application.Match(centre, w.Columns(5), 0)))
col = Val(CStr(Application.Match(produit, w.Rows(6), 0)))
If lig * col Then
cc = w.Cells(6, col).MergeArea.Columns.Count 'si cellule fusionnée
Vente = Vente + Application.Sum(w.Cells(lig, col).Resize(, cc))
End If
End If
Next
End Function