I have a column of data (B), and I would like to use VBA to calculate the averages of several ranges specified within the column. I made this UDF:
Please Login or Register  to view this content.
Then I call on this function in a subroutine as follows:

Please Login or Register  to view this content.
Where StartRow() and EndRow() hold a varying number of values depending on NumSteps.
NumSteps is the number of ranges I need to take the average of and is defined earlier in the subroutine.

The problem seems to be in the Avg function, specifically the part that finds the sum. I'm not sure why, but this value always comes out as zero.