-1

 Here's my probably I am working with 15 minute intervals so when ever I update the data my Excel Graph becomes blank. Then when I go into settings to put it on auto it has a gap then I have to manually add 1 to Manually adjust the Fixed Values, thus is there a setting I can do to stop the graph from becoming blank or is possible to make a macro which removes toggles the graph and removes the spaces. This is what the 15 min looks like 10/1/2012 0:30 . I tried to use a macro to set the maximum and minimum to ranges but Excel 2010 didnt seem to allow that.

4

1 に答える 1

2

This worked for me in XL2010:

Sub Tester()

    Dim rngDates As Range, sht As Worksheet
    Dim wsf As WorksheetFunction

    Set wsf = Application.WorksheetFunction
    Set sht = ActiveSheet
    Set rngDates = sht.Range(sht.Range("B5"), sht.Cells(Rows.Count, 2).End(xlUp))

    'set x-axis (with a padding of 1 hour either side)
    With ActiveSheet.ChartObjects("Chart 1").Chart
        .Axes(xlCategory).MinimumScale = wsf.Min(rngDates) - (1 / 24)
        .Axes(xlCategory).MaximumScale = wsf.Max(rngDates) + (1 / 24)
    End With

End Sub
于 2013-01-05T03:34:33.893 に答える