9tanstaafl9
Well-known Member
- Joined
- Mar 23, 2008
- Messages
- 535
I have a Crystal Report that generates a poorly formated Excel worksheet every day. I have created a macro that the users can install onto their personal.xls so that once this worksheet is generated, they can simply open it and click CTRL-Shift-F will make it all look nice for them and have proper totals etc.
My problem is that I need a UDF to total only the items that are bold in parts of the worksheet.
I have created this UDF and it works fine when in my test workbook, but not when only in the personal.xls. I am new to UDFS and don't know if this is because I am lacking in knowledge, or if it just isn't possible.
My UDF is:
Also, please reply in dummy-English. This is my first UDF and I don't really get them. I borrowed this from somewhere else, but it does the trick.
Thank you!
My problem is that I need a UDF to total only the items that are bold in parts of the worksheet.
I have created this UDF and it works fine when in my test workbook, but not when only in the personal.xls. I am new to UDFS and don't know if this is because I am lacking in knowledge, or if it just isn't possible.
My UDF is:
Code:
Function SumIfBold(MyRange As Range) As Double
Dim cell As Range
For Each cell In MyRange
If cell.Font.Bold = True Then
SumIfBold = SumIfBold + cell
End If
Next cell
End Function
Also, please reply in dummy-English. This is my first UDF and I don't really get them. I borrowed this from somewhere else, but it does the trick.
Thank you!