#1   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Summation

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,
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Summation

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)


--
Regards
Frank Kabel
Frankfurt, Germany


wrote:
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,

  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Summation

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?



-----Original Message-----
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)


--
Regards
Frank Kabel
Frankfurt, Germany


wrote:
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,

.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Summation [email protected] Excel Discussion (Misc queries) 2 November 28th 07 05:12 PM
Summation question T.Mad Excel Worksheet Functions 6 July 9th 07 03:05 AM
summation ExcelQuestion Excel Worksheet Functions 11 June 27th 07 02:28 AM
conditional summation boostm3 Excel Discussion (Misc queries) 3 June 6th 07 11:02 PM
Summation from a to b jeblunk Excel Worksheet Functions 3 December 4th 05 02:14 PM


All times are GMT +1. The time now is 05:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"