Getting Excel Cell Address..

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.
 
G

GS

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top