Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Copy the cell contents from one sheet to another sheet in Excel

I have two sheets, Sheet1 and Sheet2, in Sheet1 I want to copy the contents of cell A1 from Sheet2 which I’m successfully doing with =Sheet2!A1. The issue is that Sheet2 may or may not be there, in other words, the Excel document will always contain only Sheet1 and Sheet2 will at some point copied from other Excel document.

How can I make the following code stays in Sheet1 so when Sheet2 is created or copied the contents from cell A1 in Sheet2 will be shown in Sheet1?

=Sheet2!A1

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Right now, if I delete Sheet2 I get =#REF!A1 and if I re-create it, the code is not recognized, it stays as =#REF!A1 and the cell contents do not show in Sheet1.

>Solution :

Use INDIRECT and IFERROR:

=IFERROR(INDIRECT("Sheet2!A1"),"")

Note that INDIRECT is volatile and should be used sparingly or avoided if possible.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading