Hi there!
I have built a dashboard with an interactive graph that uses regular option buttons (not ActiveX) to allow the user to select the data/chart for a specific department. All this works just fine, but what I'd also like to do is change the "comments" text to match each department's graph.
I have two questions:
1. Is it possible in VBA (in a worksheet change event for example) to say: If the cell linked to the option buttons has the value of 1 (which in turn charts department 1), then make visible textbox 1, if the cell has the value of 2, then display textbox 2, etc. for all option buttons (there are 5 in total).
OR
2. Must I change the option buttons to ActiveX option buttons and say something like this: (note: the chart/textboxes on are different sheets than the option button's linked cell...)
Private Sub OptionButton1_Click()
If Me.OptionButton1.Value = True Then
ActiveWorkbook.Sheets("Sheet2").Activate
ActiveSheet.Range("A1").Value = 1
ActiveWorkbook.Sheets("sheet1").Activate
Me.TextBox1.Visible = True
Me.TextBox2.Visible = False
Me.TextBox3.Visible = False
ActiveSheet.Range("A1").Select
End If
End Sub
I tried this code and it did work, but was incredibly slow for some reason.
Any suggestions?? Or is there another way altogether??
Thanks so much!
Kim
I have built a dashboard with an interactive graph that uses regular option buttons (not ActiveX) to allow the user to select the data/chart for a specific department. All this works just fine, but what I'd also like to do is change the "comments" text to match each department's graph.
I have two questions:
1. Is it possible in VBA (in a worksheet change event for example) to say: If the cell linked to the option buttons has the value of 1 (which in turn charts department 1), then make visible textbox 1, if the cell has the value of 2, then display textbox 2, etc. for all option buttons (there are 5 in total).
OR
2. Must I change the option buttons to ActiveX option buttons and say something like this: (note: the chart/textboxes on are different sheets than the option button's linked cell...)
Private Sub OptionButton1_Click()
If Me.OptionButton1.Value = True Then
ActiveWorkbook.Sheets("Sheet2").Activate
ActiveSheet.Range("A1").Value = 1
ActiveWorkbook.Sheets("sheet1").Activate
Me.TextBox1.Visible = True
Me.TextBox2.Visible = False
Me.TextBox3.Visible = False
ActiveSheet.Range("A1").Select
End If
End Sub
I tried this code and it did work, but was incredibly slow for some reason.
Any suggestions?? Or is there another way altogether??
Thanks so much!
Kim