Summation

G

Guest

Is there a way to total all the rows that are highlighted
bold above a particular cell? I would like to do this with
a VBA macro. The rows that are highlighted bold change
often so the macro needs to be able to sort through and
total the cells that are bold.

Thank You,
 
F

Frank Kabel

Hi
try the following user defined function

public Function Sum_Bold(rng as range)
Dim ret_value
Dim cell as range
For each cell in rng
If cell.font.bold then
If IsNumeric(cell.value) then
ret_value = ret_value + cell.value
end if
end if
next
Sum_Bold = ret_value
end Function

Now use this function like
=SUM_BOLD(A1:A30)
 
G

Guest

I'm sorry, but I do not know how to set up the user
defined function. Most of my macros are set up in modules.
I have never done a public function. And the next
step "=Sum_Bold (A1:A30)" is that to be done in the
spreadsheet?
 
Top