Whenever I want to copy the following macro to add another one, Excel pops up with an error. I would like to make this link several times on the same sheet to different charts. How do I do that?
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("U1")) Is Nothing Then
On Error Resume Next
Charts(Target.Value).Activate
If Err.Number <> 0 Then
MsgBox "No such chart exists.", vbCritical, _
"Chart Not Found"
End If
On Error GoTo 0
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("U1")) Is Nothing Then
On Error Resume Next
Charts(Target.Value).Activate
If Err.Number <> 0 Then
MsgBox "No such chart exists.", vbCritical, _
"Chart Not Found"
End If
On Error GoTo 0
End If
End Sub