LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming,microsoft.public.dotnet.general,microsoft.public.dotnet.framework
external usenet poster
 
Posts: 43
Default Strange problem writing Excel formulas using .NET

I have a .NET application that, among other things, creates Excel
workbooks, and I have run into a very strange problem involving
formulas on one worksheet that reference values on another worksheet.
The text I write into, let's say, cell A25 on Sheet1 (using .NET)
looks something like this:

=VLOOKUP(RC[7],'Sheet2'!A:X,6,FALSE)

On the completed workbook this turns into:

=VLOOKUP(H25,'Sheet2'!A:X,6,FALSE)

This formula works fine when I type it in by hand, and I've been
using the RC[] syntax in .NET without trouble for quite a while
(although up until now all my formulas have only referenced their
own worksheet). But when I create this exact same formula using
..NET I get a #NAME? error!

There is nothing wrong with the text in the cell. Forcing the
workbook to calculate using F9 doesn't help. But if I double click
on the cell as if I were going to add something to the formula,
and then move away without adding anything, suddenly the formula
works! (There is further weirdness involving what happens if I
now try to drag the apparently working formula across other cells,
or when I save the workbook, but it's kind of hard to describe, so
I won't go into it here unless someone wants to know).

I've been able to get around the problem for now by using a named
range on Sheet2 instead of saying 'Sheet2'!A:X, but I'm nervous
about this, and I need to understand what is going on. I have not
been using the Formula or FormulaR1C1 properties to create formulas
-- so far I've just been assigning text to a cell, and nothing more
has seemed necessary, even for formulas. Could that be what's
causing the problem in this case, when the formulas involve another
worksheet? And if not that, then what might it be?
--
John Brock


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help writing formulas in excel using ratios Excel Hack Excel Discussion (Misc queries) 0 February 15th 06 11:40 PM
Strange Excel Problem..... Sachin Shah Excel Discussion (Misc queries) 0 November 14th 05 09:36 AM
Strange Excel problem RodShaw2 Setting up and Configuration of Excel 0 July 12th 05 05:30 PM
Problem writing Excel formulas via ODBC srikantha Excel Worksheet Functions 1 June 21st 05 06:28 PM
Problem writing Excel formulas via ODBC srikantha Excel Discussion (Misc queries) 0 June 21st 05 08:24 AM


All times are GMT +1. The time now is 07:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"