chart problem:runtime error

  • Hi,
    When I open my workbook and select a cell within a range ie "metingen1" the following error occurs: 'Runtime error 1004' unable to set the minimumscale property of the axis class.
    I have 4 ranges on sheet1 and 4 charts (chart1 to chart4 using range "metingen1" to "metingen4") on sheet2
    I'm using the following code to adjust the scale factor of the y-axis:
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)

    Dim intIndex As Integer
    Dim r As Range

    For intIndex = 1 To 4
    Set r = Range("metingen" & CStr(intIndex))
    If Not Intersect(r, Target) Is Nothing Then
    With Worksheets("Grafiek").ChartObjects("chart" & CStr(intIndex)).Chart.Axes(xlValue)
    .MinimumScale = Int(Application.Min(r)) - 0.5 'Int returns integer portion of number.
    .MaximumScale = Int(Application.Max(r)) + 0.5
    End With
    Exit For
    End If

    End Sub

    I think it is strange because it worked yesterday and know I get those problems??

    Any help welcome
    Fluppe :(

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!