Results 1 to 9 of 9

Need to sum above the active cell until bold

Threaded View

  1. #1
    Registered User
    Join Date
    07-24-2009
    Location
    mexico
    MS-Off Ver
    Excel 2003
    Posts
    5

    Need to sum above the active cell until bold

    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!
    Last edited by alansidman; 10-11-2013 at 10:57 AM. Reason: code tags added.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Highlight Active Row macro, and Bold the Active Cell
    By StudentTeacher in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-08-2013, 07:43 PM
  2. [SOLVED] bold font in accordance with active cell
    By marreco in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 02-07-2013, 08:42 AM
  3. Separating Bold from After-Bold Parts of Cell Strings
    By mlexcelhelpforum in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-19-2012, 07:11 AM
  4. Whole row of active cell should be bold
    By GI30065 in forum Excel General
    Replies: 2
    Last Post: 04-12-2007, 05:15 PM
  5. Join bold and non-bold text in one cell
    By bkincaid in forum Excel General
    Replies: 3
    Last Post: 03-20-2006, 09:10 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1