我有三列数据x值,y值和每组xy值的相应网页链接。是否可以将超链接添加到散点图中,因此当我单击数据点或数据标签时,它会在浏览器中打开链接网页?
答案 0 :(得分:2)
是的,这是可能的。但为此,您必须将图表放在单独的图表表中。设置图表后,在VBA代码中,使用图表事件Chart_Select()。例如
Private Sub Chart_Select(ByVal ElementID As Long, _
ByVal Arg1 As Long, ByVal Arg2 As Long)
'Debug.Print "Element: " & ElementID
'Debug.Print " Arg 1: " & Arg1
'Debug.Print " Arg 2: " & Arg2
'~~> Please change as required.
If ElementID = 3 Then
Select Case Arg2
Case 1: ActiveWorkbook.FollowHyperlink "http:\\Google.Com", NewWindow:=True
Case 2: ActiveWorkbook.FollowHyperlink "http:\\Gmail.Com", NewWindow:=True
Case 3: ActiveWorkbook.FollowHyperlink "http:\\Msn.Com", NewWindow:=True
End Select
End If
End Sub
这应该让你开始。如果您有任何问题,请告诉我们。)
HTH
西特