Home |
Search |
Today's Posts |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You can paste it into a module in your Personal.xls........good place to
have so's it is available for all open workbooks. What you then have to do is add the workbook reference to the function. =Personal.xls!SumColor (A10, D1D60) Gord Dibben MS Excel MVP On Mon, 15 Dec 2008 13:20:09 -0800, jeremiah wrote: Thank you, I was trying to paste it to my personal.xls "Chip Pearson" wrote: A #NAME error occurs when Excel cannot find a named range (which is not the case here) or when it cannot find a function (which is likely the case here). The SumColor VBA code must be placed in a standard code module. Press ALT F11 to open the VBA Editor, then go to the Insert menu and choose Module. This will create a module named Module1 in your workbook's code project. Paste the SumColor function in that module. Then close VBA and return to Excel. Select the cell that calls the SumColor function, press F2 and then ENTER. Cordially, Chip Pearson Microsoft MVP Excel Product Group Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Wed, 10 Dec 2008 14:30:12 -0800, jeremiah wrote: I am using a SumColor function and is returning the #Name? error. Haven't used many functions so don't quite understand what the issue is. code is below along with =SumColor (A10, D1D60) Function SumColor(rColor As Range, rSumRange As Range) Dim rCell As Range Dim iCol As Integer Dim vResult iCol = rColor.Interior.ColorIndex For Each rCell In rSumRange If rCell.Interior.ColorIndex = iCol Then vResult = WorksheetFunction.SUM(rCell) + vResult End If Next rCell SumColor = vResult End Function Thanks again for any help. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
IF function returns function statement rather than result | Excel Worksheet Functions | |||
INT Function Returns 1 | Excel Worksheet Functions | |||
VBA function returns #NAME? | Excel Programming | |||
Function returns a zero value | Excel Programming |