Hi everyone,
I'm new to the forum and this is my first post. I've tried to look for existing answers to my questions but either they don't exist or I just don't understand the answers. English is not my native tongue, so please bear with me if I dont express my self correctly.
The challenge:
I need to get the individual "pies" inside a pie chart to link to different webpages.
I'm definately not "fluent" in VBA, i'm kind of a beginner - so I browsed the web and someone came up with this:
But I'm not sure if I am using it correctly. I'm placing it inside a class module, and named the data for my chart 'series1', but I keep ketting the error message:
"Cannot run the macro 'chart.xlsm!Diagram2_Click'. The macro may not be available in this workbook or all macros may be disabled."
And I'm allowing all macros... Do anyone of you know what I am doing wrong?
Any help is greatly appreciated
Thanks in advance.
I'm new to the forum and this is my first post. I've tried to look for existing answers to my questions but either they don't exist or I just don't understand the answers. English is not my native tongue, so please bear with me if I dont express my self correctly.
The challenge:
I need to get the individual "pies" inside a pie chart to link to different webpages.
I'm definately not "fluent" in VBA, i'm kind of a beginner - so I browsed the web and someone came up with this:
Rich (BB code):
Option Explicit
Public WithEvents CHT As Chart
Private Sub Workbook_Open()
Set CHT = ActiveSheet.ChartObjects(1).Chart
End Sub
Private Sub CHT_Select(ByVal ElementID As Long, ByVal Arg1 As Long, ByVal Arg2 As Long)
On Error GoTo Fin
If Selection.Name = "series1" Then
Range("A1").Select<---- I'm putting the hyperlink in this cell
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
End If
Fin:
End Sub
"Cannot run the macro 'chart.xlsm!Diagram2_Click'. The macro may not be available in this workbook or all macros may be disabled."
And I'm allowing all macros... Do anyone of you know what I am doing wrong?
Any help is greatly appreciated
Thanks in advance.
Last edited by a moderator: