VBA to select a chart from several possible charts.

FrancisM

Board Regular
Joined
Apr 12, 2016
Messages
139
I have VBA, where a user can select one of 6 possible worksheets, as seen below:
Sub Second_Half_Reports()

Dim MyValue
Dim i AsString



'MsgBoxprompt:="Continue to 2nd 6 Months of Reports?", Title:="Voc.Rehab. - Career Link"
i =MsgBox("Continue to 2nd 6 Months of Reports?", vbYesNo, "Voc.Rehab. - Career Link")

If Not i =vbYes Then Exit Sub

'First messageshows in the body of the box, message 2 shows at the top of the box.
Do
MyValue =Application.InputBox("Click Ok or Cancel after your Selection!" &vbCrLf & _
"1 = AprilReport" & vbCrLf & _
"2 = MayReport" & vbCrLf & _
"3 = JuneReport" & vbCrLf & _
"4 = JulyReport" & vbCrLf & _
"5 = AugustReport" & vbCrLf & _
"6 =September Report", "Voc. Rehab - Career Link Data Entry")
' Submessaage box exit.
If MyValue = False Then
ExitSub
ElseIf(MyValue = 1) Or (MyValue = 2) Or (MyValue = 3) Or (MyValue = 4) Or (MyValue =5) Or (MyValue = 6) Then
Exit Do
Else
MsgBox"You have not made a valid entry. Please try again.", vbInformation, "Voc. Rehab. - CareerLink"
End If
Loop 'Code to Execute When Condition = value_1
Select CaseMyValue
Case 1
If ActiveSheet.CodeName = "Sheet51" Then
Sheets("April_Report").Activate
Range("A1").Select
End If
'Code toExecute When Condition = value_2
Case 2
End If
'Code toExecute When Condition = value_3

Case

EndIf
'Code to Execute When Condition = value_4
Case 4
EndIf
'Code toExecute When Condition = value_5
Case5

EndIf
'Code toExecute When Condition = value_6
Case 6

End Select
End Sub
I am trying to do the same thing with charts. The charts are named & all on the same sheet. I have found code to delete charts, but nothing to select a chart.

I am using MS office 365.
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

Forum statistics

Threads
1,214,924
Messages
6,122,293
Members
449,077
Latest member
Rkmenon

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top