I have a query I am hoping you can help me with.
I have an Excel chart and I want the user to be able to change to range of the x-axis to any number between 2 and 100. They do this simply by entering a number in a cell and the chart x-axis should automatically update so that the Max. Number for the x-axis equals the user input value.
For the sake of argument suppose that the cell that the user needs to enter the number in is cell A1.
I already have the code that changes the x-axis, which is as follows:
The problem is I don't know how to get the spreadsheet to execute this piece of code. I thought that the SelectionChange event might be the one I need but I can't get it to work.Code:With ActiveSheet .ChartObjects("Chart 1").Chart.Axes(xlCategory).MaximumScale = Range("A1") End With
Also, ideally I only want the spreadsheet to do anything if cell A1 only is changed i.e. it doesn't need to update the chart x-axis if some other cell is changed.
So ideally I need code that says:
Thanks in advanceCode:If Cell A1 is changed then make the x-axis of Chart 1 equal the new value
-Rob




Reply With Quote