L
LenS
Hello,
I am building a procedure a piece at a time and would appreciate some
help tweaking some old code that was given me. Here is the old code:
Option Explicit
Function CalcI3(mylocation As Range) As Single
Application.Volatile
Dim LC As Integer
If IsEmpty(mylocation.Offset(0, 1)) Then
Exit Function
ElseIf mylocation.Offset(0, 1) < 1 Then
Exit Function
End If
'initialize
CalcI3 = 0
For LC = 0 To mylocation.Offset(0, 1) - 1
CalcI3 = CalcI3 + mylocation.Offset(-LC, -1)
Next
End Function
How do I substitute CalcI3 for NUM when NUM is:
NUM = NUM + (1+ count) * (Price[count])
Here is the data table in part:
Price Num Period (count)
5.29 1
5.34 4
5.31 4
5.25 7
5.20 9
5.23 11
5.32 12
5.38 14
The different thing I am trying to do here is multiply price with the
counter. What else do I have to add to the code to do this? I tried
just putting a (*) but did not get the proper result.
I would just like to enter NUM as a function into its column.
Thanks,
LenS
I am building a procedure a piece at a time and would appreciate some
help tweaking some old code that was given me. Here is the old code:
Option Explicit
Function CalcI3(mylocation As Range) As Single
Application.Volatile
Dim LC As Integer
If IsEmpty(mylocation.Offset(0, 1)) Then
Exit Function
ElseIf mylocation.Offset(0, 1) < 1 Then
Exit Function
End If
'initialize
CalcI3 = 0
For LC = 0 To mylocation.Offset(0, 1) - 1
CalcI3 = CalcI3 + mylocation.Offset(-LC, -1)
Next
End Function
How do I substitute CalcI3 for NUM when NUM is:
NUM = NUM + (1+ count) * (Price[count])
Here is the data table in part:
Price Num Period (count)
5.29 1
5.34 4
5.31 4
5.25 7
5.20 9
5.23 11
5.32 12
5.38 14
The different thing I am trying to do here is multiply price with the
counter. What else do I have to add to the code to do this? I tried
just putting a (*) but did not get the proper result.
I would just like to enter NUM as a function into its column.
Thanks,
LenS