I have a workbook with data on sheet1 and 3 charts on sheet2.
3 Charts because there is too much data for 1 chart.
The Y-scale values of the charts are automatically set.
This works by entering the following code in sheet1.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim intIndex As Integer
Dim r As Range
For intIndex = 1 To 3
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
Here is the problem:
A user enters data by using a userform.
The chart will be adjusted when excel detect any changes on the worksheet.
But because of entering data by a userform it doesn’t detect any changes. I have to select the changed cells my self before the chart will adjust.
How can I solve the problem so that excel detects changes after pressing OK on the userform?