Option Explicit
Sub CheckPoint()
Dim WS As Worksheet
Dim cChart As ChartObject
Dim Sr As Series
Dim Pt As Point
Dim I As Long
Set WS = ActiveSheet
For Each cChart In WS.ChartObjects
For Each Sr In cChart.Chart.SeriesCollection
If Sr.Name = "InputValue" Then
Sr.Values = Range("O36")
Sr.XValues = Range("O37")
For Each Pt In Sr.Points
Pt.MarkerBackgroundColor = 3
Pt.MarkerSize = 7
Next Pt
End If
Next Sr
Next cChart
End Sub
Function FindY(X As Double) As String
Dim WS As Worksheet
Dim cChart As ChartObject
Dim Sr As Series
Dim Pt As Point
Dim I As Long
Dim bFound As Boolean
Set WS = ActiveSheet
For Each cChart In WS.ChartObjects
For Each Sr In cChart.Chart.SeriesCollection
If Sr.Name <> "InputValue" Then
For I = LBound(Sr.XValues) To UBound(Sr.XValues)
If Sr.XValues(I) = X Then
FindY = Sr.Values(I)
bFound = True
Exit Function
End If
Next I
End If
Next Sr
Next cChart
FindY = "NO"
End Function
How can I get the Y value of a line in VBA if I know the X value. I need the value of the line that excel creates because of the curves excel adds when it smoothes the lines between points.
~bp