Total up bold cells

Registration date
Sunday November 16, 2014
Last seen
August 20, 2015
Good afternoon

I am using an Excel 2007 spreadsheet to keep track of costs associated with a holiday.

I have bolded all the expenses which have already been paid and I would now like to total these. I have found a VBA code that works, but it does not appear to update as I bold more cells. And as soon as I change any of the data within the cell range, the cell with the sumifbold formula throws out an error: #NAME?

I am not experienced in using VBA code.

Here is the code I used:
Function SumIfBold(MyRange As Range) As Double

Dim cell As Range
For Each cell In MyRange
If cell.Font.Bold = True Then
SumIfBold = SumIfBold + cell
End If
Next cell

End Function

Have I done something wrong? Is there a better way??