+ Reply to Thread
Results 1 to 8 of 8

Graphing Line Chart using Code

  1. #1
    Registered User
    Join Date
    07-25-2014
    Location
    london
    MS-Off Ver
    2013
    Posts
    58

    Graphing Line Chart using Code

    I need help creating a macro that graphs a line chart with markers for the table I attached. I am new to visual basic and not sure how to achieve this. I need two separate graphs. One graph uses the data only for location 1 and other for only location 2. The y-axis is the average and the x-axis is the distance highlighted in blue. I only need the averages from distance 120 to 260. I highlighted the range for the averages in yellow for location 1 and in red for location 2. I will have more headers other than the example spreadsheet so I need it to graph as long as there are so many headers. I need the line width to be 1 pt and the marker width to be .75 pt. If someone could please help I would appreciate it.
    Attached Files Attached Files
    Last edited by visualnewbie09; 08-07-2014 at 03:54 PM.

  2. #2
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Graphing Line Chart using Code

    hi visualnewbie09, if I understood everything correctly it should be what you are looking for. Please check attachment, run code "test" or press Run button on Sheet1 in left upper corner.

    Marker size should be in range from 2 to 72. For now it is 2 points.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    07-25-2014
    Location
    london
    MS-Off Ver
    2013
    Posts
    58

    Re: Graphing Line Chart using Code

    I need to change the locations to left and right how would I incorporate that into the code especially this line "Set c = .Find("Location " & i, , xlValues, xlWhole)"

  4. #4
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Graphing Line Chart using Code

    please check attachment
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    07-25-2014
    Location
    london
    MS-Off Ver
    2013
    Posts
    58

    Re: Graphing Line Chart using Code

    How would I change it to work for this setup, but all in one graph.
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    07-25-2014
    Location
    london
    MS-Off Ver
    2013
    Posts
    58

    Re: Graphing Line Chart using Code

    Thank you watersev for the help

  7. #7
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Graphing Line Chart using Code

    please check attachment
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    07-25-2014
    Location
    london
    MS-Off Ver
    2013
    Posts
    58

    Re: Graphing Line Chart using Code

    Thank you for the tremendous help!

+ 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. [SOLVED] Graphing/Formatting a Line Chart
    By cwwazy in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 03-21-2014, 12:39 PM
  2. Line Chart Not Graphing Data Correctly
    By rhudgins in forum Excel General
    Replies: 2
    Last Post: 09-16-2010, 01:12 PM
  3. VBA code to change pivot chart line on 12 charts
    By NMullis in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 05-13-2009, 11:48 AM
  4. Graphing : Dynamic line chart axes
    By schnett in forum Excel General
    Replies: 1
    Last Post: 01-16-2009, 06:23 AM
  5. Code for creating line between two cells - Spaghetti chart
    By mohitmahajanin in forum Excel Charting & Pivots
    Replies: 6
    Last Post: 06-20-2008, 04:28 AM

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