0

I am trying to create Excel Automation Add-ins with C# to add new functions to Excel. Like this example: http://blogs.msdn.com/b/eric_carter/archive/2004/12/01/273127.aspx I am quite new to programming such add-ins.

One of these functions calculates with numbers on a referred row from the current column until a referred stop column.

Using the function in Excel should be like: MyFunction("3:3", 10) Where row 3 contains the values and column 10 is the last to include in calculation.

If the function is entered in cell E4, I would like to calculate with the numbers in the range E3:J3.

Is it possible to get information about the cell from where the current function is called? If the function is called from cell E4 I would like to get the column number for column E in the function.

Demanding that the user enters the current column number in the function call seems like a waste of time and a unnecessary source for errors: MyFunction("3:3", Column(), 10). These functions are also implemented as custom functions in SpreadsheetGear and in a old XLL-file, so I would really prefer not to change the number of arguments.

Frode
  • 1

1 Answers1

0

You can use SpreadsheetGear.CustomFunctions.IArguments.CurrentColumn to get the column of the cell being evaluated in a SpreadsheetGear custom function.

Joe Erickson
  • 7,077
  • 1
  • 31
  • 31
  • I have already implemented these functions with SpreadsheetGear. I am now trying to implement them as Excel automation add-ins. – Frode May 24 '13 at 09:05