Copy cells from one workbook to another

I am trying to copy some cells from a worksheet in one workbook to another worksheet in another workbook. I can sucessfully do this when copying from a range of cells to another in the same worksheet but get ‘Top-left cell is incorrectly specified when going between workbooks.’

I’m using noteData.CopyTo(toAddr) where noteData is the result of a noteData = wsn.Cells.GetSubrange(custNote), wsn is the source sheet and toAddr is 'Reports"!B10 where Reports is the sheet name of the destination sheet.

Not sure what I doing wrong here. There’s no frozen panes or anything similar involved.

Is there an example of how to acheive this anywhere. Have not been able to find one.

Thanks.

Hi Lindsey,

What exactly is the value of your toAddr?

The one you wrote has a single quote at the beginning and a double quote at the end of the sheet’s name, which is wrong.

Try using this:

noteData.CopyTo("'Reports'!B10")

Or this:

noteData.CopyTo("Reports!B10")

If the problem remains, please send us a small Visual Studio project that reproduces it so that we can investigate it.

Regards,
Mario