davinosky
New Member
Hi. Chandoo, just to ask you for a little help!
I'm kind of stuck here with a grafic compounding two years and the VBA that I wrote seems not to be working properly. I Intend to visualize both years from the same source. How could i change the source of charts using VBA codes and a Combobox control? or is it somenthing else?
Here is the VBA I wrote:
Sub DropDown2_Change()
'
' DropDown2_Change Macro
'
'
Select Case Sheets("2010-11").Range("M1")
Case 1
'Sheets("grafica").Select
ActiveSheet.ChartObjects("grafica").Activate
ActiveChart.ChartArea.Select
ActiveChart.SetSourceData Source:=Sheets(" V-C-I 2010").Range("A4:F4")
ActiveChart.SetSourceData Source:=Sheets(" V-C-I 2010").Range("A4:F4,A6:F6")
ActiveChart.SetSourceData Source:=Sheets(" V-C-I 2010").Range("A4:F4,A6:F6,A8:F8")
ActiveChart.SetSourceData Source:=Sheets(" V-C-I 2010").Range("A4:F4,A6:F6,A8:F8,A10:F10")
Case 2
'Sheets("grafica").Select
ActiveSheet.ChartObjects("grafica").Select
ActiveChart.ChartArea.Select
ActiveChart.SetSourceData Source:=Sheets(" V-C-I 2011").Range("A4:F4")
ActiveChart.SetSourceData Source:=Sheets(" V-C-I 2011").Range("A4:F4,A6:F6")
ActiveChart.SetSourceData Source:=Sheets(" V-C-I 2011").Range("A4:F4,A6:F6,A8:F8")
ActiveChart.SetSourceData Source:=Sheets(" V-C-I 2011").Range("A4:F4,A6:F6,A8:F8,A10:F10")
End Select
End Sub
Thanks a lot for your continuous support!
I'm kind of stuck here with a grafic compounding two years and the VBA that I wrote seems not to be working properly. I Intend to visualize both years from the same source. How could i change the source of charts using VBA codes and a Combobox control? or is it somenthing else?
Here is the VBA I wrote:
Sub DropDown2_Change()
'
' DropDown2_Change Macro
'
'
Select Case Sheets("2010-11").Range("M1")
Case 1
'Sheets("grafica").Select
ActiveSheet.ChartObjects("grafica").Activate
ActiveChart.ChartArea.Select
ActiveChart.SetSourceData Source:=Sheets(" V-C-I 2010").Range("A4:F4")
ActiveChart.SetSourceData Source:=Sheets(" V-C-I 2010").Range("A4:F4,A6:F6")
ActiveChart.SetSourceData Source:=Sheets(" V-C-I 2010").Range("A4:F4,A6:F6,A8:F8")
ActiveChart.SetSourceData Source:=Sheets(" V-C-I 2010").Range("A4:F4,A6:F6,A8:F8,A10:F10")
Case 2
'Sheets("grafica").Select
ActiveSheet.ChartObjects("grafica").Select
ActiveChart.ChartArea.Select
ActiveChart.SetSourceData Source:=Sheets(" V-C-I 2011").Range("A4:F4")
ActiveChart.SetSourceData Source:=Sheets(" V-C-I 2011").Range("A4:F4,A6:F6")
ActiveChart.SetSourceData Source:=Sheets(" V-C-I 2011").Range("A4:F4,A6:F6,A8:F8")
ActiveChart.SetSourceData Source:=Sheets(" V-C-I 2011").Range("A4:F4,A6:F6,A8:F8,A10:F10")
End Select
End Sub
Thanks a lot for your continuous support!