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
Forloop needs aStep -1to descend by 1,For i = UBound(ColArray) To 0 Step -1. How are you calling this function?