Gráficas
Buen día tengan todos ustedes, en esta ocasión programaremos en excel la representación de determinadas formulas como los son: x², x³, raíz cuadrada, 1/x, sin(x), cos(x).
Private Sub CommandButton1_Click()
Dim a, b, c, li, ls, i As Integer
Dim res As Single
a = Range("b1").Value
b = Range("b2").Value
c = Range("b3").Value
li = Range("e1").Value
ls = Range("e2").Value
i = 6
While i <= (ls - li) + 6
Cells(i, 2).Value = li + (i - 6)
Cells(i, 3).Value = (a * (Cells(i, 2).Value * Cells(i, 2).Value)) + (b * Cells(i, 2).Value) + c
i = i + 1
Wend
crea_grafica (2), 3, 6, (ls - li) + 6
Private Sub CommandButton1_Click()
Dim li, ls, i As Double
Dim res As Single
li = Range("e1").Value
ls = Range("e2").Value
i = 6
While i <= (ls - li) + 6
Cells(i, 2).Value = li + (i - 6)
Cells(i, 3).Value = Sqr(Cells(i, 2).Value)
i = i + 1
Wend
crea_grafica (2), 3, 6, (ls - li) + 6
Private Sub CommandButton1_Click()
Dim li, ls, i As Integer
Dim res As Single
li = Range("e1").Value
ls = Range("e2").Value
i = 6
While i <= (ls - li) + 6
Cells(i, 2).Value = li + (i - 6)
Cells(i, 3).Value = Cos(Cells(i, 2).Value)
i = i + 1
Wend
crea_grafica (2), 3, 6, (ls - li) + 6
End Sub
Private Sub CommandButton1_Click()
Dim a, b, c, d, li, ls, i As Integer
Dim res As Single
a = Range("b1").Value
b = Range("b2").Value
c = Range("h1").Value
d = Range("h2").Value
li = Range("e1").Value
ls = Range("e2").Value
i = 6
While i <= (ls - li) + 6
Cells(i, 2).Value = li + (i - 6)
Cells(i, 3).Value = (a * (Cells(i, 2).Value * Cells(i, 2).Value * Cells(i, 2).Value)) + (b * (Cells(i, 2).Value * Cells(i, 2).Value)) + (c * Cells(i, 2).Value) + d
i = i + 1
Wend
crea_grafica (2), 3, 6, (ls - li) + 6
End Sub
Private Sub CommandButton1_Click()
Dim li, ls, i As Integer
Dim res As Single
li = Range("e1").Value
ls = Range("e2").Value
i = 6
While i <= (ls - li) + 6
Cells(i, 2).Value = li + (i - 6)
Cells(i, 3).Value = 1 / Cells(i, 2).Value
i = i + 1
Wend
crea_grafica (2), 3, 6, (ls - li) + 6
End Sub
A continuación les dejo los resultados de los códigos ya con gráfica.
Espero que sea util, muchas gracias
Comentarios
Publicar un comentario