Hi,

for some reason I can not do this because I am new to VBA. How can I get a chart reference be made available in a userform?
I know module's is where you would want to declare global variables, but I still have a problem there.

In my spreadsheet:
VB Code:
  1. Private sub transferChart()
  2.   Sheets("Sheet1").ChartObjects("Chart 1").Activate
  3.   Call toModule(ActiveChart)
  4. End Sub

In Module:
VB Code:
  1. Public Function toModule(ByVal mychart As Chart)
  2.   chartA = mychart
  3. End Function
  4. 'userform would call this function to get the chart reference from spreadsheet
  5. Public Function returnChart() As Chart
  6.   returnChart = chartA
  7. End Function

this way seems kind of tedious. Is there another way, becuase this one isn't working.