Sum Debit and Credit Balances seperately formatted in Bold

Nades

New Member
Joined
Jun 15, 2016
Messages
3
Hi There,

Please can someone assist me with VBA code for the following.

I have printed my Age Analysis into Excel and want to sum up the Debit Balances and Credit Balances separately and only need to sum the totals which are formatted in Bold.

I.E.
sum column N if values are positive and Bold
sum column N if values are negative and Bold

Thank you.
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Hi,

Copy this code into a module, and you'll be able to use the functions just as a normal sum. SUMPOS to get the total of the positive and bold cells, and SUMNEG for the negative and bold cells.

Function sumpos(rng As Range)

Dim c As Range

For Each c In rng.Cells

If c.Value > 0 And c.Font.Bold = True Then

sumpos = sumpos + c.Value

End If

Next c


End Function

Function sumneg(rng As Range)

Dim c As Range

For Each c In rng.Cells

If c.Value < 0 And c.Font.Bold = True Then

sumneg = sumneg + c.Value

End If

Next c


End Function




 
Upvote 0

Forum statistics

Threads
1,215,477
Messages
6,125,036
Members
449,205
Latest member
Eggy66

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