A
Ajithabe
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel I am using user defined function "ColourFunction" on earlier versions of Office on Mac. I use that function to add values connected with different colours. For reference I will copy the script I used.
-------------
Function ColorFunction(rColor As Range, rRange As Range, Optional SUM As Boolean)
Dim rCell As Range
Dim lCol As Long
Dim vResult
lCol = rColor.Interior.ColorIndex
If SUM = True Then
For Each rCell In rRange
If rCell.Interior.ColorIndex = lCol Then
vResult = WorksheetFunction.SUM(rCell, vResult)
End If
Next rCell
Else
For Each rCell In rRange
If rCell.Interior.ColorIndex = lCol Then
vResult = 1 + vResult
End If
Next rCell
End If
ColorFunction = vResult
End Function
--------------------
I used it under Module to run on workbook.
Please give me some guidelines or convert this to Applescript that allows me to work on Excel 2008 on Mac.
Thanks a lot in advance your support
-------------
Function ColorFunction(rColor As Range, rRange As Range, Optional SUM As Boolean)
Dim rCell As Range
Dim lCol As Long
Dim vResult
lCol = rColor.Interior.ColorIndex
If SUM = True Then
For Each rCell In rRange
If rCell.Interior.ColorIndex = lCol Then
vResult = WorksheetFunction.SUM(rCell, vResult)
End If
Next rCell
Else
For Each rCell In rRange
If rCell.Interior.ColorIndex = lCol Then
vResult = 1 + vResult
End If
Next rCell
End If
ColorFunction = vResult
End Function
--------------------
I used it under Module to run on workbook.
Please give me some guidelines or convert this to Applescript that allows me to work on Excel 2008 on Mac.
Thanks a lot in advance your support