Results 1 to 4 of 4

Thread: How to debug plotting error

  1. #1

    Thread Starter
    Fanatic Member VBAhack's Avatar
    Join Date
    Dec 2004
    Location
    Sector 000
    Posts
    617

    How to debug plotting error

    Using VBA modules in a data analysis application to compute statistical results that I update to an Excel worksheet with existing plots (i.e. the plots aren't created each time but automatically update because the underlying data changes). Several plots use log scale. None of the result are negative and I've taken great pains to make sure none of the results are zero by making sure any result is at least E-17.

    From time to time get the annoying dialog box with the message that "Negative or zero values cannot be plotted on log charts" but cannot for the life of me find any result that is zero or negative. Since Excel found something it didn't like, is there any way to further investigate exactly what it doesn't like? It is sort of like going to a doctor with a pain but not revealing the location of the pain.
    Last edited by VBAhack; Mar 27th, 2015 at 12:59 PM.

  2. #2
    PowerPoster
    Join Date
    Oct 2008
    Location
    Midwest Region, United States
    Posts
    3,574

    Re: How to debug plotting error

    Where are you storing the data that is attempting to update the graphs? Is it all visible?

  3. #3

    Thread Starter
    Fanatic Member VBAhack's Avatar
    Join Date
    Dec 2004
    Location
    Sector 000
    Posts
    617

    Re: How to debug plotting error

    Quote Originally Posted by vbfbryce View Post
    Where are you storing the data that is attempting to update the graphs? Is it all visible?
    Data is stored in worksheet cells and is visible. That's how I know nothing is negative or zero.

  4. #4
    PowerPoster
    Join Date
    Oct 2010
    Posts
    2,141

    Re: How to debug plotting error

    It is hard to say what is happening with out the ability to see the code and the spreadsheet setup, but perhaps it is due to some calculation taking place on partially revised data.

    Try disabling automatic calculation prior to updating the values.

    Code:
    Dim currentMode As XlCalculation
    currentMode = Application.Calculation
    Debug.Print ThisWorkbook.CalculationVersion
    
    Application.Calculation = xlCalculationManual
    
    ' your code
    
    Application.Calculation = currentMode
    Application.Calculate
    Debug.Print ThisWorkbook.CalculationVersion

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width