I have an EXCEL VBA function which should return the address of the first cell where the cell value is greater zero but it is not working. Does anyone has an idea why?
Code:
Function FindNextFilledCell(RowArray() As Integer, ColArray() As Integer)
For i = UBound(ColArray) To 0
For j = UBound(RowArray) To 0
CellValue = cells(RowArray(j), ColArray(i)).Value
If CellValue > 0 Then
FindNextFilledCell = cells(RowArray(j), ColArray(i)).Address(False, False)
Exit Function
End If
Next j
Next i
End Function
I am still trying to understand what you are trying to do but I suggest the first error is:
instead of
This assumes you meant to search the cells in reverse order. If you did not
might be better.
The next error I have spotted is that you have not defined the type of the value returned by the function. Try: