[QUOTE=Leto III;1530370]Текущий код - в студию - поглядим, чего это он))
доставку
Скрытый текст - code:
Option Explicit
Public Type TableRow
Id As Integer
manufacturer As String
buyer As String
product As String
price As Currency
Cost As Currency
End Type
Public Sub ty()
Dim r(0 To 11) As TableRow, i%, MySum%
For i = 0 To 11
r(i).Id = Cells(2 + i, 1)
r(i).manufacturer = Cells(2 + i, 2)
r(i).buyer = Cells(2 + i, 3)
r(i).product = Cells(2 + i, 4)
r(i).price = Cells(2 + i, 5)
r(i).Cost = Cells(2 + i, 6)
next i
For i = 0 To 11
Cells(2 + i, 7) = r(i).Id
Cells(2 + i, 8) = r(i).manufacturer
Cells(2 + i, 9) = r(i).buyer
Cells(3 + i, 10) = r(i).product
Cells(3 + i, 11) = r(i).price
Cells(2 + i, 12) = r(i).Cost
Next i
Dim avg As Currency
avg = MySum / UBound(r)
End Sub
Function MySum(j As Integer) As Currency
If j >= 0 Then
Return R(j).Cost + MySum(j - 1)
Else
Return 0
End If
End Function
дело в том что он выводит нули в расчетах