D
dorutzu
Hi,
I only started a few days ago working with Excel add-ins.
I would like to make a function (that can be called from a cell!),
that will fill an array of values and return them on the sheet. To be
more clear, I would like to write in a cell(i.e. A1) =MyFunc(), and
when the function is called, in the cells A1-B4 I will have values
like:
0 11
1 11
2 21
3 31
I tried using the FP stucture, and I wrote something like this:
...
{" MyFunc", " K", " MyFunc", " ", " 1", " MyCat", " ", " ", " test
func"},
...
FP* __stdcall AVM_Schedule(void)
{
FP arr;
arr.rows = 4;
arr.columns = 2;
for(int i=0; i<4; i++)
for(int j=0; j<2; j++)
arr.array[i*4+j]=i*10+j;
return &arr
}
When I run this function, I get the first value in the array (in this
case 0) in the cell where I entered the function call.
Probably I'm trying a wrong approach. Could you please help me get on
the right track? Some sample code about this issue would be very nice.
Thanks!
Best regards,
Doru K
I only started a few days ago working with Excel add-ins.
I would like to make a function (that can be called from a cell!),
that will fill an array of values and return them on the sheet. To be
more clear, I would like to write in a cell(i.e. A1) =MyFunc(), and
when the function is called, in the cells A1-B4 I will have values
like:
0 11
1 11
2 21
3 31
I tried using the FP stucture, and I wrote something like this:
...
{" MyFunc", " K", " MyFunc", " ", " 1", " MyCat", " ", " ", " test
func"},
...
FP* __stdcall AVM_Schedule(void)
{
FP arr;
arr.rows = 4;
arr.columns = 2;
for(int i=0; i<4; i++)
for(int j=0; j<2; j++)
arr.array[i*4+j]=i*10+j;
return &arr
}
When I run this function, I get the first value in the array (in this
case 0) in the cell where I entered the function call.
Probably I'm trying a wrong approach. Could you please help me get on
the right track? Some sample code about this issue would be very nice.
Thanks!
Best regards,
Doru K