Closed Thread
Results 1 to 3 of 3

putting column headings on the x-axis of each line chart

  1. #1
    Registered User
    Join Date
    03-11-2012
    Location
    china
    MS-Off Ver
    Excel 2007
    Posts
    3

    putting column headings on the x-axis of each line chart

    Hi Guys,
    I am working with line charts and i am successively drawing line charts based on the number of rows. Each row contains one line chart and every time chart is drawn on new worksheet (e.g., if there are 5 rows then on single click 5 line charts will be drawn).
    The problem that i am facing is, How to put column headings on the x-axis of each chart.
    NOTE: Row heading is already appearing on the y-axis of each chart.
    I have also attached my excel sheet for better understanding of my problem.....I want to display DP1, DP2, DP3,... so on on the X-axis of each line graph/chart. Here is my code:

    Sub LineCharts()
    Dim Ws As Worksheet
    Dim NewWs As Worksheet
    Dim cht As Chart
    Dim LastRow As Long
    Dim CurrRow As Long

    Set Ws = ThisWorkbook.Worksheets("Sheet1")

    LastRow = Ws.Range("A65536").End(xlUp).Row
    For CurrRow = 2 To LastRow
    Set NewWs = ThisWorkbook.Worksheets.Add
    NewWs.Name = Ws.Range("A" & CurrRow).Value
    Set cht = ThisWorkbook.Charts.Add
    With cht
    .ChartType = xlLine
    .SeriesCollection.NewSeries

    .SeriesCollection(1).Values = "=" & Ws.Name & "!R" & CurrRow & "C3:R" & CurrRow & "C8"
    .SeriesCollection(1).Name = "=" & Ws.Name & "!R" & CurrRow & "C2"
    .Location Where:=xlLocationAsObject, Name:=NewWs.Name
    End With
    Next CurrRow
    End Sub
    Attached Files Attached Files

  2. #2
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: putting column headings on the x-axis of each line chart

    Duplicated Post see accessing x-axis of line chart

  3. #3
    Registered User
    Join Date
    03-11-2012
    Location
    china
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: putting column headings on the x-axis of each line chart

    Yeh...That was mistakenly done by me...please tell me the solution

Closed Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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