ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copying named range returns #N/A (https://www.excelbanter.com/excel-programming/427593-copying-named-range-returns-n.html)

Fergus[_2_]

Copying named range returns #N/A
 
Hello,

I have a macro that copies a named range from one workbook to another.
The line of code is:

DestinationWorkbook.Range(rname).Value = OriginalWorkbook.Range
(rname).Value

This works great, but sometimes my named range in the destination
workbook is larger than the original. In this case the range in the
destination workbook is returning #N/A for all of the extra cell
addresses that are not in the original named range. I would like to
return a blank instead of #N/A if the the address in the destination
workbook doesn't exist in the original.

Hope this makes sense. I apologize if it's been addressed. I didn't
see it.


Don Guillett

Copying named range returns #N/A
 

To do it this way the ranges must be the same size. Instead you could use
copy/paste values
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Fergus" wrote in message
...
Hello,

I have a macro that copies a named range from one workbook to another.
The line of code is:

DestinationWorkbook.Range(rname).Value = OriginalWorkbook.Range
(rname).Value

This works great, but sometimes my named range in the destination
workbook is larger than the original. In this case the range in the
destination workbook is returning #N/A for all of the extra cell
addresses that are not in the original named range. I would like to
return a blank instead of #N/A if the the address in the destination
workbook doesn't exist in the original.

Hope this makes sense. I apologize if it's been addressed. I didn't
see it.




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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com