Naresh Patel
asked on
Select Data Points From Chart
Hi Experts,
Is there any way to select data Point from Excel chart & it will reflect on Spread sheet - Column?
Thanks
Is there any way to select data Point from Excel chart & it will reflect on Spread sheet - Column?
Thanks
ASKER
Assume I have stock data in excel chart & if I choose select mode & what ever point I select on chart it will reflect on spreadsheet column. is that possible ?
Thanks
Thanks
ASKER
Is That Possible?
Hi,
See example
With class Module named CHighlightPoint
EE20140410.xlsm
See example
With class Module named CHighlightPoint
Public WithEvents cht As Chart
Private Sub cht_MouseDown(ByVal Button As Long, ByVal Shift As Long, _
ByVal x As Long, ByVal y As Long)
HighlightPoint x, y
End Sub
Private Sub HighlightPoint(ByVal x As Long, ByVal y As Long)
Dim ElementID As Long
Dim Arg1 As Long
Dim Arg2 As Long
Dim SeriesAddress As String
Dim ArrRange As Variant
cht.GetChartElement x, y, ElementID, Arg1, Arg2
If ElementID = xlSeries And Arg2 <> -1 Then
Set ser = cht.SeriesCollection(Arg1)
SeriesAddress = Split(Split(ser.Formula, ",")(2), "!")(1)
FirstCell = Split(SeriesAddress, ":")(0)
Set Rng = Range(SeriesAddress)
ArrRange = Rng
If UBound(ArrRange, 1) > UBound(ArrRange, 2) Then
Set myCell = Range(FirstCell).Offset(Arg2 - 1)
Else
Set myCell = Range(FirstCell).Offset(0, Arg2 - 1)
End If
Rng.Interior.Pattern = xlNone
myCell.Interior.Color = vbYellow
End If
End Sub
and module code use ActivateChart to be able to Highlight the points
Global gclsHighlightPoint As New CHighlightPoint
Sub ActivateChart()
If Not ActiveChart Is Nothing Then
Set gclsHighlightPoint.cht = ActiveChart
Else
MsgBox "Select a chart and try again.", vbExclamation, "No Active Chart"
End If
End Sub
Sub DeactivateChart()
Set gclsHighlight.cht = Nothing
End Sub
RegardsEE20140410.xlsm
Is the code in a class module?
Is the class module named like I wrote?
Is the class module named like I wrote?
ASKER
will you pls send me WB which have this modules? I am attaching mine...see what is the problem
LT-Chart-Select.xlsm
LT-Chart-Select.xlsm
ASKER
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Sir Rgonzo1971,
i had just thought in my mind ...as it is possible or not? and you come with super-fast code.really impressive.i cant test your file as i am @ home. surly i will revert you back. as generally i dotn like to expert to waite for my reply but coincidentally i have some things to do today....
Thanks
i had just thought in my mind ...as it is possible or not? and you come with super-fast code.really impressive.i cant test your file as i am @ home. surly i will revert you back. as generally i dotn like to expert to waite for my reply but coincidentally i have some things to do today....
Thanks
ASKER
Sir Rgonzo1971,
Awesome - Mind blowing.
Thank You Very Very Much
Awesome - Mind blowing.
Thank You Very Very Much
ASKER
May I ask one step further on this context? (New Question)
New Question is a good idea
ASKER
Could you be more precise?
Regards