Windows Phone Developers

Friday, July 30, 2010

VB.NET Excel Offset Function / C# Excel Offset Function

How to Offset Excel Ranges using VB.NET / C#

The following code gives you a better insight into offsetting a range using C#. The code uses get_Offset method to Offset the range

private void MathTableExample()
        {
            Microsoft.Office.Interop.Excel.Range oRng;
            oRng = Globals.ThisAddIn.Application.get_Range("A1");

            for (int i = 1; i <= 10; i++)
            {
                // Uses Offset Method of Excel     
                oRng.get_Offset(i, 0).Value2 = "9 x " + i.ToString() + " = " + (i * 9).ToString();
            }


        }

Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

No comments:

Post a Comment