
Originally Posted by
WizzardOfOz
I suggest instead of for each rCell in rRange you should loop rows and columns
(untested code below, may be minor typos)
for iRow = 1 to ubound(lCol,1)
for jCol = 1 to ubound(lcol,1)
for k = jCol+1 to ubound(lcol,1) -1
if lCol(iRow,k) = lcol(iRow,jCol) then lCol(iRow,k) = -1 'flag as already counted
next k
next jCol
next iRow
Then can continue as normal or include code in upper loop to add
Hi wizzardOfOz:
Thanks for the reply, i really didn't get it, but a friend on a forum helped with the function and ended with this code
Code:
Function ColorFunction(rColor As Range, rRange As Range, Optional SUM AsBoolean)
Dim i As Long, ii As Long For i = 1 To rRange.Rows.Count For ii = 1 To rRange.Columns.Count If rRange(i, ii).Interior.ColorIndex = rColor.Interior.ColorIndex Then ColorFunction = ColorFunction + IIf(SUM, Val(rRange(i, ii).Value), 1) Exit For End If Next Next End Function
I share it and hope it help someone else. I know there are a lot of people out there with similar situations. Thanks a lot WizardOfOz, i really appreciate your help bro. Have a nice day
Bookmarks