• C++ Programming for Financial Engineering
    Highly recommended by thousands of MFE students. Covers essential C++ topics with applications to financial engineering. Learn more Join!
    Python for Finance with Intro to Data Science
    Gain practical understanding of Python to read, understand, and write professional Python code for your first day on the job. Learn more Join!
    An Intuition-Based Options Primer for FE
    Ideal for entry level positions interviews and graduate studies, specializing in options trading arbitrage and options valuation models. Learn more Join!

Changing Excel Cells using a XLL (created with C++ / XLW)

Joined
12/15/12
Messages
3
Points
11
Hi everyone,

I guess some of you have worked with user-defined functions (UDFs) in Excel using your own Addin. I am currently working with XLW, which is a wrapper that simplifies creating Addins (*.xll) with Visual C++.

Imagine the following C++ sample code, which increments the first parameter and then returns a sum.
-------------------------------------------------------
double sumOfTwo(double &arg1, double &arg2)
{
arg1++; // increment arg1 for some reason
return arg1+arg2;
}
-------------------------------------------------------

With an .xll (or .dll respectively) I can now call this function in an Excel cell, e.g. "=sumOfTwo(A1;A2)"
The cell with the formula displays the correct sum, but the value in A1 is not incremented. Do you have an idea how to make a correct By-Reference call from Excel to C++ / XLW ?
I'm basically looking for a way to manipulate a cell, which is used as function parameter.

Cheers
SeanKw
 
Last edited:
Excel functions (via xll or even vba) are not mean't to modify/delete/insert cell references. These tasks are mean't to be handled through excel macros. There are work arounds to make a function do these but they are not recommended at all.
There must a way to define a macro in XLW. Email their forum-group and someone will help you out.

Steve
http://www.deltaquants.com
 
Back
Top