Microsoft Office Tutorials and References
In Depth Information
Changing the Data Used in a Chart
Figure 18-7: This chart always displays the data from the row of the active cell.
This example uses an event handler for the Sheet1 object. The SelectionChange event
occurs whenever the user changes the selection by moving the cell pointer. The event-handler
procedure for this event (which is located in the code module for the Sheet1 object) is as
Private Sub Worksheet_SelectionChange(ByVal Target _
As Excel.Range)
If CheckBox1 Then Call UpdateChart
End Sub
In other words, every time the user moves the cell cursor, the Worksheet_SelectionChange
procedure is executed. If the Auto Update Chart check box (an ActiveX control on the sheet) is
checked, this procedure calls the UpdateChart procedure, which follows:
Sub UpdateChart()
Dim ChtObj As ChartObject
Dim UserRow As Long
Search JabSto ::

Custom Search