Getting Excel Cell Address..

  • Thread starter Thread starter nechoor
  • Start date Start date
N

nechoor

How do I get the cell address of an excel sheet from C#?
VBA
=Address(4, 5) would return "$E$4"

Not able to find an equivalent function when processing the excel
sheet from C#.

Thanks in advance for all the help.
 
are you trying to formulate formulas into the spreadsheet?
whatever function you can access via vba, you can access the same way using
office interop regardless vb.net or c#

- if you don`t need the formula in the spreadsheet but just need to display
the value in spreadsheet
or if you are just using your 2 dimensional array to set value into the
spreadsheet, you can do calculation w/o the absolute address. instead you
use get_range on the spreadsheet

with only
using Microsoft.Office.Core;
using Microsoft.Office;
you still access most of the function of excel function pretty well the same
way except sometime you need get_ prefix

you could try out the following and see what you get
protected Excel.Range oRng = oSheet.get_Range("E4", "E4");
oRng.get_Address

btw oSheet is private Excel._Worksheet oSheet;

I assume you know how to deal with the rest, if not you can search term on
C# excel automation
 
Back
Top