×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Excel 2003 / 2007 compatibility - colour sum

Excel 2003 / 2007 compatibility - colour sum

Excel 2003 / 2007 compatibility - colour sum

(OP)
Hi

I'm supposed to be calculating the sum of cells based on their font colour.

i'm working in excel 2003, and i've got the Vba module code for the process -

CODE

 Function ColorFunction(rColor As Range, rRange As Range, Optional SUM As Boolean)
    Dim rCell As Range
    Dim lCol As Long
    Dim vResult
     
    
    lCol = rColor.Font.ColorIndex
     
    If SUM = True Then
        For Each rCell In rRange
            If rCell.Font.ColorIndex = lCol Then
                vResult = WorksheetFunction.SUM(rCell, vResult)
            End If
        Next rCell
    Else
        For Each rCell In rRange
            If rCell.Font.ColorIndex = lCol Then
                vResult = 1 + vResult
            End If
        Next rCell
    End If
     
    ColorFunction = vResult
End Function

i've got it to work, and add up all of the sums of the colours - no problem.

I then saved it, and went to my colleagues computer, running office (excel) 2007, tried to open the file - it opens, but where i've wrote the cell formula (sample: =ColorFunction($G5060,CU$761:CU$5053,TRUE) )all i get is #NAME? in every cell, i've tried rewriting the formula, rewriting the vb code (copy paste), but i still cant get it to show the formula results.

just to confirm - it works in 2003, but not 2007.

what am i doing wrong?

Thanks

 

RE: Excel 2003 / 2007 compatibility - colour sum

Are the macros enabled?

combo

RE: Excel 2003 / 2007 compatibility - colour sum

Following up Combo's post - check macro security settings.

_____
-John

    The plural of anecdote is not data

Help us help you. Please read FAQ 181-2886 before posting.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close