Results 1 to 2 of 2

Thread: Excel Select Chart Index

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2012
    Posts
    8

    Excel Select Chart Index

    i have the following code:

    Code:
    Sub GetTLineEq()
      Dim chrtobj As ChartObject
      Dim chrt As Chart
      Dim srs As Series
      Dim tline As trendline
      Dim dlbl As DataLabel
      Dim str As String
    
      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.Text
        .Range(Selection.Address).Value = str
      End With
    End Sub
    This code only works for ChartObjects(1), but I would like it to work with the chart that I selected. I have many charts in the sheet. Many thanks

  2. #2

    Thread Starter
    New Member
    Join Date
    Jun 2012
    Posts
    8

    Re: Excel Select Chart Index

    Sorry wrong thread.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width