Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Okay, people. Can someone see an error in this UDF code??? I'm coming
up with a "#VALUE!" error. Public Function findfuel(rng As Range) Dim rCell As Range Dim mytotal As Double Dim numberofcells As Integer Dim myaverage As Double Const sStr As String = "fuel" For Each rCell In rng If InStr(1, rCell.Comment.Text, sStr, vbTextCompare) Then mytotal = mytotal + rCell.Value numberofcells = numberofcells + 1 myaverage = mytotal / numberofcells End If Next rCell findfuel = average End Function Seems pretty straightforward. Any help would be appreciated. Thanks. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Code to copy the formulae of one cell to all the cell in the rangewith the specific cell and columnnumber changing Options | Excel Discussion (Misc queries) | |||
Extract text within two specific values within a cell | Excel Worksheet Functions | |||
select date range then find average of values in another cell | Excel Worksheet Functions | |||
find specific text and make cell highlighted | Excel Discussion (Misc queries) | |||
Can Comments be automatically converted to text cell values? | Excel Discussion (Misc queries) |