Solved

Select Data Points From Chart

Posted on 2014-04-09
14
408 Views
Last Modified: 2014-04-11
Hi Experts,

Is there any way to select data Point from Excel chart & it will reflect on Spread sheet - Column?


Thanks
0
Comment
Question by:itjockey
  • 9
  • 5
14 Comments
 
LVL 49

Expert Comment

by:Rgonzo1971
ID: 39990762
Hi,

Could you be more precise?

Regards
0
 
LVL 8

Author Comment

by:itjockey
ID: 39990783
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
0
 
LVL 8

Author Comment

by:itjockey
ID: 39990867
Is That Possible?
0
 
LVL 49

Expert Comment

by:Rgonzo1971
ID: 39991048
Hi,

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

Open in new window

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

Open in new window

Regards
EE20140410.xlsm
0
 
LVL 8

Author Comment

by:itjockey
ID: 39991065
Error
Thank You
0
 
LVL 49

Expert Comment

by:Rgonzo1971
ID: 39991077
Is the code in a class module?

Is the class module named like I wrote?
0
 
LVL 8

Author Comment

by:itjockey
ID: 39991109
will you pls send me WB which have this modules? I am attaching mine...see what is the problem
LT-Chart-Select.xlsm
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 8

Author Comment

by:itjockey
ID: 39991118
i had seen your attachment...its seems working fine, but i want to select ZigZag Points in Chart & want that selected points in some different column in sheet ...say C column.Selected Points Want In Sheet

Thanks
0
 
LVL 49

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 39991243
Hi,

let try this

it seems that Stock chart cannot be combined with another chart

Now the code is adjusted for dates descending
EE20140410v1.xlsm
0
 
LVL 8

Author Comment

by:itjockey
ID: 39991685
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
0
 
LVL 8

Author Closing Comment

by:itjockey
ID: 39993510
Sir Rgonzo1971,

Awesome - Mind blowing.


Thank You Very Very Much
0
 
LVL 8

Author Comment

by:itjockey
ID: 39993511
May I ask one step further on this  context? (New Question)
0
 
LVL 49

Expert Comment

by:Rgonzo1971
ID: 39993530
New Question is a good idea
0
 
LVL 8

Author Comment

by:itjockey
ID: 39993565
Next Quetion Link


Thank you Very Very Much
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
This tutorial explains how to create a series of drop-down lists that are dependent upon prior selections to guide (“force”) the user to make the correct selection and reduce data errors within Microsoft Excel. Excel 2010 was used for this tutorial;…
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now