View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
John Barr John Barr is offline
external usenet poster
 
Posts: 5
Default VBA Function Not Recognized or Execution Issue

I have an excel VBA Function and it used to work fine in Office 2003. In
2007, it doesnt. I get an error #name. All it does is cycle through 1 column,
comparing the date value to determine if its between the date range passed
in, if it is, it scans the next column and determines if a date exists, if
not, it tallies a count of it and returns the total of those records without
a date in the 2nd column. Here is the code.

Function CalcOpen(ByVal vBegin, ByVal vEnd)
'Application.Volatile (True)
Dim sCell, iTot, sCells

iTot = 0

For Each oCell In Worksheets("Requests").Range("A2:A1000").Cells
If oCell.Value = DateValue(vBegin) And oCell.Value <=
DateValue(vEnd) Then
sCell = "B" + Mid(oCell.Address, 4)
If IsNull(Worksheets("Requests").Range(sCell).Cells.V alue) Or
IsEmpty(Worksheets("Requests").Range(sCell).Cells. Value) Then
iTot = iTot + 1
End If
End If
Next
CalcOpen = iTot
End Function