SafetyHammer
New Member
- Joined
- Sep 4, 2016
- Messages
- 2
Hi,
I have a code that copy the polynomial equation from a graph in excel,
y = -0.0008x3 + 0.0832x2 + 9.5105x - 0.7195 (formula keep changing depending on graph data)
I am trying to solve the formula for a given Y value. my problem is I am unable to convert it to a real formula in VBA so I can solve it
Wondering if anyone can help with the conversion
I have a code that copy the polynomial equation from a graph in excel,
y = -0.0008x3 + 0.0832x2 + 9.5105x - 0.7195 (formula keep changing depending on graph data)
I am trying to solve the formula for a given Y value. my problem is I am unable to convert it to a real formula in VBA so I can solve it
Code:
Sub CalcualteValveOPening() Dim chrtobj As ChartObject
Dim chrt As Chart
Dim srs As Series
Dim tline As Trendline
Dim dlbl As DataLabel
Dim str As String
Dim z As Integer
Dim x As Integer
With ActiveSheet
Set chrtobj = ActiveSheet.ChartObjects(1)
Set chrt = chrtobj.Chart
Set srs = chrt.SeriesCollection(1)
Set tline = srs.Trendlines(1)
Set dlbl = tline.DataLabel
str = dlbl.Formula
.Range("E27").Value = str
End With
For x = 0 To 100 Step 0.5
z = Range("E27").Value
If z / Range("E24").Value <= 1 Then Range("E29").Value = x
Next x
End Sub
Wondering if anyone can help with the conversion