Function Magasins(CP$) As String
Application.Volatile
Dim cel As Range, mg$, ca#, tot#, n%, lig&, dcol%, chn$, s$, i%
With Worksheets("CA")
Set cel = .Columns(1).Find(CP, , -4163, 1, 1)
If cel Is Nothing Then Exit Function
dcol = .Cells(1, Columns.Count).End(1).Column
If dcol < 3 Then Exit Function
lig = cel.Row
For i = 2 To dcol - 1
mg = .Cells(1, i)
If mg <> "" Then
With .Cells(lig, i)
ca = Round(.Value, 2)
If ca > 0 And mg <> "(vide)" Then
s = Format(ca, "#,##0.00")
chn = chn & mg & " :" & Space$(18 - Len(s)) & s & vbLf
tot = tot + ca: n = n + 1
End If
End With
End If
Next i
End With
If n > 0 Then chn = chn & vbLf & n & _
" magasins : " & Format(tot, "#,##0.00")
Magasins = chn
End Function