Sum Bold Numbers with Macro

constantinet

New Member
Joined
Mar 9, 2017
Messages
16
I am looking for macro that will sum bolded numbers
The numbers that I need sum are located in B2:D2 and I would like the total number in E
Numbers are automatically bolded from a pivot table created with macro.

Thank you in advance for any help provided.
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Is there only one number per cell or can there be more than one number per cell? If the latter case, can you post an example?
 
Upvote 0
This is a UDF which should sum bold numbers …

Code:
Function SumBold(Rg As Range) As Double

Dim c As Range, x As Double

Application.Volatile
For Each c In Rg
    If c.Font.Bold = True Then
        x = x + c.Value
    End If
Next

SumBold = x

End Function
 
Upvote 0
There is one number per cell


Code:
Sub SumBold()
Dim S As Double, c As Range
For Each c In Range("B2:D2")  'change range to suit
    If IsNumeric(c.Value) And c.Font.Bold Then S = S + c.Value
Next c
Range("E2").Value = S
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top