Hi,
Ive been trying to change the code related to post http://www.excelforum.com/excel-gene...ntil-bold.html in order to sum above the active cell until it hits a bold cell.
Currently the code sums below the active cell until it finds a bold one.
Function SumNotBold(rng As Range) As Double
Dim c As Range, acall As Range
Set acall = Application.Caller.Offset(1)
Set funcrng = Intersect(Range(acall, acall.End(xlDown)), rng, Application.Caller.Parent.UsedRange)
For Each c In funcrng
If c.Font.Bold = True Then Exit For
SumNotBold = SumNotBold + IIf(IsNumeric(c), c, 0)
Next
End Function
I've tried changing it to:
Function SumNotBold(rng As Range) As Double
Dim c As Range, acall As Range
Set acall = Application.Caller.Offset(-1)
Set funcrng = Intersect(Range(acall, acall.End(xlUp)), rng, Application.Caller.Parent.UsedRange)
For Each c In funcrng
If c.Font.Bold = True Then Exit For
SumNotBold = SumNotBold + IIf(IsNumeric(c), c, 0)
Next
End Function
with no success.
Can anyone help me or explain me where to start?
Thanks in advance!
Bookmarks