Results 1 to 2 of 2

accessing x-axis of line chart

Threaded View

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

    accessing x-axis of 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 the problem.....I want DP1, DP2, DP3,....on the x-axis of each line graph.
    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

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