You are on page 1of 1

Sub Calculo() Dim x(100) Dim y(100) Dim Lg Dim suma Dim n ValorX = Hoja1.Cells(6, 8).Value suma = 0 n = Hoja1.

Cells(6, 4).Value For i = 0 To n x(i) = Hoja1.Cells(9, c + 1) y(j) = Hoja1.Cells(12, c + 1) Next i For i = 0 To n Lg = 1 For j = 0 To n If j <> i Then Lg = Lg * (ValorX - x(j)) / (x(i) - x(j)) End If Next j suma = Lg * y(i) + suma Next i Hoja1.Cells(8, 12) = suma End Sub

You might also like