Stclements1
Board Regular
- Joined
- Sep 15, 2018
- Messages
- 150
- Office Version
- 365
- Platform
- Windows
I found this code on the web and have put this into a module and whilst it works it doesn't update if there is a change in the array being calculated.
For example if I had 18 values of which 9 were bold and came to a value of 780 and then one of those bold values were no longer bold the value wouldn't change. Is there further coding that I can put into the function so it updates automatically. In addition the code rounds up the numbers rather than giving the exact number.
For example if I had 18 values of which 9 were bold and came to a value of 780 and then one of those bold values were no longer bold the value wouldn't change. Is there further coding that I can put into the function so it updates automatically. In addition the code rounds up the numbers rather than giving the exact number.
VBA Code:
Function SumBold(WorkRng As Range)
Dim Rng As Range
Dim xSum As Long
For Each Rng In WorkRng
If Rng.Font.Bold Then
xSum = xSum + Rng.Value
End If
Next
SumBold = xSum
End Function