ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Linking Chart directly to VBA function returning 2d array (https://www.excelbanter.com/excel-programming/316524-linking-chart-directly-vba-function-returning-2d-array.html)

Damien Sawyer

Linking Chart directly to VBA function returning 2d array
 
Hello,

Can anyone tell me if it's possible to link a chart directly to a VBA
function that returns a 2d array?

I've had a play but had no luck.



Cheers



Damien Sawyer

keepITcool

Linking Chart directly to VBA function returning 2d array
 
Damien,


At first I could NOT get it to work...
(I'm NO expert on charts.. but i AM curious and 'creative')


the ADD method (or manually editing the series source would NOT accept
formulas or named formulas..


However I discovered it can be fooled :)


First I defined the name Sheet1!Test = =sheet1!$a$1

I pointed the dataseries to that NAME =Sheet1!test

THEN i changed the names definition to =GetData()
which is the name of my UDF..

Public Function GetData()
'dummy function
GetData = Array(120, 150, 180)
End Function

TADA!!!!!


howeever that's still a 1D array..
please experiment yourself using this approach..


--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Damien Sawyer wrote :

Hello,

Can anyone tell me if it's possible to link a chart directly to a VBA
function that returns a 2d array?

I've had a play but had no luck.



Cheers



Damien Sawyer



All times are GMT +1. The time now is 06:46 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com