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.
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.