Summation

  • Thread starter Thread starter Guest
  • Start date Start date
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,
 
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)
 
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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top