I am a supporter of St. Joseph's hospice. If you find this site useful or if it helped you, consider a small donation to St. Joseph's, please.
If you have an area filled with numbers of different currencies (i.e. different number formats) and if you need to calculate totals for all of these:

Function SumMyFormat(r As Range)
'Sums up all values in r which have the same number format
'as calling cell (where this 'function is called from).
'Please keep in mind that this function is NOT automatically
'updated if an input cell format changes because that does
'not trigger a recalculation event! To ensure an up-to-date
'calculation you need to do this yourself
'(with CTRL + ALT + F9, for example).
'Reverse("moc.LiborPlus.www") PB V0.20 05-May-2010
Dim v
For Each v In r
If v.NumberFormat = Application.Caller.NumberFormat Then
SumMyFormat = SumMyFormat + v
End If
Next v

Please note that changing a cell color does not trigger a recalculation of dependent cells.
You would need to invoke manually with CTRL + ALT + F9, for example.
Other reasonable options to ensure an up-to-date calculation of dependent cells are a manual button which starts the recalc or an event procedure which starts this whenever a different cell is being selected, for example. Please see this 27 KB Excel 2007 sample file but open and use at your own risk, please read my disclaimer.
Function CountMyColor(r As Range)
'Counts all cells of r which have the same color as calling
'cell (where this 'function is called from).
'Please keep in mind that this function is NOT automatically
'updated if an input cell format changes because that does
'not trigger a recalculation event! To ensure an up-to-date
'calculation you need to do this yourself
'(with CTRL + ALT + F9, for example).
'Reverse("moc.LiborPlus.www") PB V0.10 05-May-2010
Dim v
For Each v In r
If v.Interior.Color = Application.Caller.Interior.Color Then
CountMyColor = CountMyColor + 1
End If
Next v
[Sulprobil] [Get it done] [Organisation] [IT] [Controlling] [Human Resources] [Family] [Contact] [Download] [Disclaimer]