Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim I As Long
Dim Total As Double
I = 5
Do
If Cells(2, I).EntireColumn.Hidden = True Then Total = Total + Cells(2, I).Value
I = I + 1
Loop While Cells(2, I).Value <> ""
Range("C2") = Total
End Sub
Function SOMMENONVISIBLE(Rng As Range)
Application.Volatile
For Each cell In Rng
If cell.Columns.Hidden = True Then
total = total + cell.Value
End If
Next
SOMMENONVISIBLE = total
End Function
=sommenonvisible(D2:H2)