+ Reply to Thread
Results 1 to 2 of 2

Amending chart in VBA - problem with XValues in xlXYScatter

  1. #1
    Registered User
    Join Date
    04-04-2012
    Location
    Manchester, England
    MS-Off Ver
    Excel 2003
    Posts
    6

    Amending chart in VBA - problem with XValues in xlXYScatter

    Having trouble with the following code:

    Please Login or Register  to view this content.
    The code executes, there are no syntax errors. The XValues are in date format, as per the data in Column A. When I step through this in the debugger, when I execute the XValues statement above, the X-axis has the correct labels, in date format. When the next statement executes, the XValues change to take the values 1 to 4.5, in 0.5 increments. This grading is based on the number of observations, 4. I know this because if I increase the number of observations to 10, the XValues scale changes to 1 to 10. I don't want it to change from what I've set it to, i.e. the date values in Column A. However, if I run the XValues statement after setting the chart type, it doesn't change back. What is wrong?

  2. #2
    Registered User
    Join Date
    04-04-2012
    Location
    Manchester, England
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Amending chart in VBA - problem with XValues in xlXYScatter

    I've answered my own question...it turns out that the dates in column A were not being treated as dates by Excel. This is because, when the file is opened using Workbooks.Open , Excel reads in the dates using the m-d-y format by default. Mine are in d-m-y format as I'm in the UK. The workaround was in specifying the Local keyword in the Open statement, as follows:

    Please Login or Register  to view this content.
    So it wasn't actually a problem with the Chart at all - that fixed itself as soon as I made this change.

+ 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] xlXYScatterLines and xlXYScatter data in the same chart?
    By pylolzier in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-11-2012, 11:32 AM
  2. [SOLVED] error when setting XValues for chart
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-08-2006, 12:10 AM
  3. [SOLVED] Displaying XValues and Values for chart using VBA
    By Barb Reinhardt in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 01-12-2006, 09:40 PM
  4. [SOLVED] Can't set Chart's SeriesCollection XValues
    By BW in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-26-2005, 01:05 AM
  5. [SOLVED] Changing XValues and Values in a chart
    By lee.christopher in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-29-2005, 08:05 PM
  6. Replies: 3
    Last Post: 08-19-2005, 04:05 PM
  7. [SOLVED] Can't Set XValues for Surface Chart
    By Jack in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 03-26-2005, 04:07 AM
  8. Problem adding Series XValues to Chart using VBA
    By Sean Curry in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 03-13-2005, 09:06 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