Tech Support Guy banner
Status
Not open for further replies.
1 - 1 of 1 Posts

·
Registered
Joined
·
2 Posts
Discussion Starter · #1 ·
Hi,

I have written a Multivariate Normal C++ function and exported it into a DLL so that I can use it in my VBA Programs. In addition, I have written a VBA function that allows me to use the multivariate Normal function in my Excel spreadsheets.

The function works fine as long as it is linked to only non-random cells. If I try linking it to random cells, however, the function only works if the cells are made random after the links are established. If the cells are random at the time I enter my function, Excel crashes. The following illustrates the dependence on the order in which the functions are entered.

Linking Method A: (Works)

1. My function is entered into cell A3 and is linked to cells A1 and A2, where A1 contains the number 0 and A2 the number 1

2. The rand() function is entered into cells A1 and A2

My function produces the desired results and can be refreshed using the F9 key

Linking Method B: (Does not Work)

1. The rand() function is entered into cells A1 and A2
2. My function is entered into cell A3 and is linked to cells A1 and A2.

The entry of my function into cell A3 causes Excel to crash...

I have tried a number of different things but have been unable to figure out why this dependence exists. I think it must have something to do with how excel sets up its links between the different cells. I am hoping to create an add-in that uses the function and want to avoid these crashes.

Does anyone have an idea of how I can get around this problem?

Additional information:

The Multivariate normal C++ function takes pointers to Safearrays as its arguments. In a univariate normal function, I passed pointers to doubles and the problem does not occur for that function. I can provide additional details if it would help in solving the problem.

mcmcman
 
1 - 1 of 1 Posts
Status
Not open for further replies.
Top