+ Reply to Thread
Results 1 to 2 of 2

add a target line to a chart

Hybrid View

  1. #1
    Registered User
    Join Date
    06-24-2015
    Location
    Vermont
    MS-Off Ver
    2010
    Posts
    50

    add a target line to a chart

    currently I am making a chart in VBA and I am trying to get a target line. I have a code that works but it uses a range and they are always the same number
    is there a way to code it so it just looks at 1 cell so I don't have to have the same number in every cell in the comuln? sorry if this sounds confusing! heres what I have noe




    With ChrtSrs3
             .MarkerStyle = xlMarkerStyleNone
             .Name = "Target"
             .Values = Range("R6:R66")
            .XValues = Range(Cells(x, 1), (Cells(Y, 1)))
         End With

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,650

    Re: add a target line to a chart

    Try:
    Dim myvals(1 To 2) As Double, myXvals(1 To 2) As Double
    myvals(1) = 3 'of course here values you'd put in R column
    myvals(2) = 3
    myXvals(1) = 1 'and here Cells(x, 1)
    myXvals(2) = 6 ' and Cells(Y, 1)
    With ChrtSrs3
             .MarkerStyle = xlMarkerStyleNone
             .Name = "Target"
             .Values = myvals
             .XValues = myXvals
    End With
    Best Regards,

    Kaper

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to add target line to stacked column pivot chart chart
    By oleg mirzaev in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 11-04-2013, 07:46 AM
  2. Target line in chart
    By Alexandra26 in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 08-29-2013, 12:58 AM
  3. Adding target line to a chart
    By md1972 in forum Excel General
    Replies: 0
    Last Post: 08-23-2010, 05:27 PM
  4. create chart with target line
    By soul_krasty in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 05-21-2010, 04:57 AM
  5. Insert a target line to a chart
    By ugg in forum Excel General
    Replies: 1
    Last Post: 03-29-2009, 08:16 PM
  6. Target Line on Chart
    By scottma in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 02-19-2008, 01:01 AM
  7. target line in bar chart
    By chinascot69 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 07-28-2006, 07:55 AM
  8. Chart Target Line
    By AlDeb in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 10-11-2005, 01:05 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1