#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 270
Default Custom UDF

I have a UDF that have tried to add to my Personal.xls, so it will be
available as needed. (It works fine if I put the code in a normal workbook.)
It is in a regular module in my Personal.xls VBA project. After researching
thought it had to do with needing to add a reference to Personal.xls; when I
try to do that via Tools/References/Browse and select Personal.xls it adds
'VBAProject' to the list of references with a checkmark, but then says that
the name conflicts with an existing module, project or object library and
removes it. Am confused about what I'm doing wrong here. Any advice please?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 638
Default Custom UDF

It should work fine in your Personal.xls workbook. It could have to
do with the code in the UDF. If you are referencing something like
ThisWorkbook, then it is trying to apply the UDF to the Personal.xls
workbook, which would be incorrect. Could you post up the UDF code?

Paige wrote:
I have a UDF that have tried to add to my Personal.xls, so it will be
available as needed. (It works fine if I put the code in a normal workbook.)
It is in a regular module in my Personal.xls VBA project. After researching
thought it had to do with needing to add a reference to Personal.xls; when I
try to do that via Tools/References/Browse and select Personal.xls it adds
'VBAProject' to the list of references with a checkmark, but then says that
the name conflicts with an existing module, project or object library and
removes it. Am confused about what I'm doing wrong here. Any advice please?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 270
Default Custom UDF

Thanks, JW; here is the code:

Option Explicit
Function SumColor(rColor As Range, rSumRange As Range)
'Sums cells based on a specified fill color
'Formula: =sumcolor(cell with desired color to sum,range to sum)

Application.Volatile True

Dim rCell As Range
Dim iCol As Integer
Dim vResult As Single

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

"JW" wrote:

It should work fine in your Personal.xls workbook. It could have to
do with the code in the UDF. If you are referencing something like
ThisWorkbook, then it is trying to apply the UDF to the Personal.xls
workbook, which would be incorrect. Could you post up the UDF code?

Paige wrote:
I have a UDF that have tried to add to my Personal.xls, so it will be
available as needed. (It works fine if I put the code in a normal workbook.)
It is in a regular module in my Personal.xls VBA project. After researching
thought it had to do with needing to add a reference to Personal.xls; when I
try to do that via Tools/References/Browse and select Personal.xls it adds
'VBAProject' to the list of references with a checkmark, but then says that
the name conflicts with an existing module, project or object library and
removes it. Am confused about what I'm doing wrong here. Any advice please?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Format Cell as custom type but data doesn't display like I custom. ToMMie Excel Discussion (Misc queries) 6 September 11th 08 08:31 AM
2003 - 2007 custom macro and custom button restore. Scott Sornberger Excel Discussion (Misc queries) 11 May 23rd 08 02:41 PM
Adding custom list and text boxes to the custom tool bar from Excel C API Mousam Excel Discussion (Misc queries) 0 August 7th 07 09:19 AM
Can you link a custom property to an Excel custom header text? LouErc Setting up and Configuration of Excel 0 November 8th 05 04:58 PM
Excel custom plots and custom trend lines Mark Brantana Excel Programming 0 November 10th 03 06:48 AM


All times are GMT +1. The time now is 01:45 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"