+ Reply to Thread
Results 1 to 2 of 2

C# Issue with Existing Formulas

  1. #1
    Registered User
    Join Date
    04-02-2010
    Location
    Amherst, Mass
    MS-Off Ver
    Excel 2007
    Posts
    1

    C# Issue with Existing Formulas

    I'm having trouble running formulas in an excel 2007 spreadsheet based on data written to the spreadsheet from a C# .NET 3.5 program. I check the number format and it is set to number. However, my formula using the data in these cells says it's 0. Here's how I'm writing the data to the spreadsheet:

    Range range = objSheet.get_Range("A1", "Z" + iRow.ToString());
    range.set_Value(Missing.Value, fields);
    range.get_Range("A1", "Z" + iRow.ToString()).NumberFormat = "0.00";

    where iRow is the last row in the range. Here is a formula that takes two cells written to from the program:

    =SUM(U4,U5)

    The result of this is 0. The values in U4 & U5 are 128.25 and 128.25. Their number formats are both "0.00". Why can I add U4 and U5 to get the right sum?

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: C# Issue with Existing Formulas

    I doubt you'll get much help here on C#; we are VBA centric.

    In any case, please take a few minutes to read the forum rules, and then edit your post to add CODE tags.

    Thanks.
    Entia non sunt multiplicanda sine necessitate

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1