Try this:

voltage = Application.WorksheetFunction.Average(Range("B1:B" & i))