strikethrough condition

J

JoeC

I am using VBA as below

Function SumStrikethrough(rng As Range) As Integer
Dim c As Range
For Each c In rng.Cells
SumStrikethrough = SumStrikethrough -
c.Font.Strikethrough
Next
End Function

to add all the amounts in a col which have a
strikethrough font. But the function appears to count the
number of cells instead of summing. Any help to ammend
would be appreciated.
Regards
JoeC
 
F

Frank Kabel

Hi
use
Function SumStrikethrough(rng As Range) As Integer
Dim c As Range
For Each c In rng.Cells
if c.Font.Strikethrough then
SumStrikethrough = SumStrikethrough + c.value
end if
Next
End Function
 

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

Top