Update cell that references a cell from a different worksheet within the same Workbook

47 Views Asked by At

I have an existing Excel workbook and need to recreate the workbook with different equations. So far so good, but I am stuck on the following. Sheet1 contains alist of accounts and I have to reference them on Sheet2, so that any changes on Sheet1 will auto update Sheet2.

I am using C# to complete the task as the Workbook contains over 10,000 entries on Sheet1.

I have tried the following

Sheet1.Range["A2"].Formula = "=+Sheet2!A50";

But all I get is the Update Values dialog, because I assume that it thinks Sheet2 is in another Workbook, but it is not.

What would be the correct way for me to add the above. I have tried using a cell reference along with a Value and Value2 options.

TBH Not sure, but I have tried with and without to no avail. In essence, all I need to be able to bring the value of Sheet2!A50 and display that in in A2 on Sheet2.

1

There are 1 best solutions below

0
gilesrpa On

Ok, the + sign is irrelevant, but the name of the sheet is. On the original the sheet name was spelt incorrectly. It had an extra space on the end, so finally not Sheet2, but 'Sheet2 ' spotting this, made the change and bingo. All working.