PDA

View Full Version : Change graph source data by vba



tommy1234
04-20-2014, 09:32 AM
Hello
I have a table with data (attached) and i want to put a combo box that when the user will choose for example 'A' on the combo box values the graph will be with data from table 'A' and when he'll choose b the graph will be from table 'B'.
table a different !!! so the code should indicates for different range.

Thanks

Avi

Bob Phillips
04-20-2014, 04:25 PM
With ActiveSheet.ChartObjects("Chart 1").Chart

Select Case ActiveSheet.Range("N1")

Case 1: .SetSourceData Source:=Range("A5:D11")
Case 2: .SetSourceData Source:=Range("A16:C22")
Case 3: .SetSourceData Source:=Range("A28:C34")
End Select
End With