+ Reply to Thread
Results 1 to 5 of 5

Can't input date range as x-axis in scatter with straight lines chart using VBA

  1. #1
    Registered User
    Join Date
    10-30-2011
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    10

    Can't input date range as x-axis in scatter with straight lines chart using VBA

    Hi,

    I have been trying to plot scatter with straight lines type of plot using VBA macro.

    I have date and time in first column and few parameters in next columns. I want date to be x-axis and selected parameter to be y-axis. I have not had problem in plotting same Line type of charts using VBA macro. When I select scatter with straight lines type of chart, 0 to 1000 (or so) is coming as x-axis and selected parameter as y-axis.

    Why can't i get date in x-axis? Any idea?

  2. #2
    Registered User
    Join Date
    10-30-2011
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Can't input date range as x-axis in scatter with straight lines chart using VBA

    Line chart Code:

    Sheets("data sheet").Select
    Range("g5").Select
    ActiveSheet.Shapes.AddChart.Name = "1"
    ActiveSheet.ChartObjects("1").Select
    ActiveChart.ChartType = xlLine
    ActiveChart.SeriesCollection.NewSeries
    ActiveChart.SeriesCollection(1).Name = Cells(startrow, para1a)
    ActiveChart.ChartTitle.Select
    Selection.Delete
    ActiveChart.SeriesCollection(1).XValues = Range(Cells(startrow + 1, 1), Cells(totalrows, 1))
    ActiveChart.SeriesCollection(1).Values = Range(Cells(startrow + 1, para1a), Cells(totalrows, para1a))
    ActiveSheet.ChartObjects(1).Activate
    ActiveChart.Axes(xlCategory).Select
    Selection.TickLabels.NumberFormat = "m/d/yyyy"
    Selection.TickLabels.NumberFormat = "[$-409]d-mmm-yy;@"
    Selection.TickLabelPosition = xlLow

  3. #3
    Registered User
    Join Date
    10-30-2011
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Can't input date range as x-axis in scatter with straight lines chart using VBA

    Scatter chart code:



    Sheets("data sheet").Select
    Range("g5").Select
    ActiveSheet.Shapes.AddChart.Name = "1"
    ActiveSheet.ChartObjects("1").Select
    ActiveChart.ChartType = xlXYScatterLinesNoMarkers
    ActiveChart.SeriesCollection.NewSeries
    ActiveChart.SeriesCollection(1).Name = Cells(startrow, para1a)
    ActiveChart.ChartTitle.Select
    Selection.Delete
    ActiveChart.SeriesCollection(1).XValues = Range(Cells(startrow + 1, 1), Cells(totalrows, 1))
    ActiveChart.SeriesCollection(1).Values = Range(Cells(startrow + 1, para1a), Cells(totalrows, para1a))
    ActiveSheet.ChartObjects(1).Activate
    ActiveChart.Axes(xlCategory).Select
    Selection.TickLabels.NumberFormat = "m/d/yyyy"
    Selection.TickLabels.NumberFormat = "[$-409]d-mmm-yy;@"
    Selection.TickLabelPosition = xlLow

  4. #4
    Registered User
    Join Date
    10-30-2011
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Can't input date range as x-axis in scatter with straight lines chart using VBA

    Line type

    \1

  5. #5
    Registered User
    Join Date
    10-30-2011
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Can't input date range as x-axis in scatter with straight lines chart using VBA

    scatter type

    \1

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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