run time error 1004

J

Jake

When running code that copies one named range from a workbook to a named
range in another workbook I get this run time error saying Select Method of
Range Class failed. If i copy the range manually i get the message: "A
formula or sheet you want to move or copy contains the name
'WPCodeDescription', which already exists on the destinatin sheet. Do you
want to use this version of the name?" Here is the code that causes the
error:

Workbooks(WkbPrevious).Worksheets(CStr(Cell)).Range("WPCodeDescription").Copy

Workbooks(wkb).Worksheets(CStr(Cell)).Range("WPCodeDescription").PasteSpecial
xlPasteValues

thanks for any help,
Jake
 
J

Jim Thomlinson

You don't need to copy and paste. Just make the values equal. Try this
instead...


Workbooks(wkb).Worksheets(CStr(Cell)).Range("WPCodeDescription").Value = _
Workbooks(WkbPrevious).Worksheets(CStr(Cell)).Range("WPCodeDescription").Value
 
J

Jake

That's a help, thanks a million Jim!

Jim Thomlinson said:
You don't need to copy and paste. Just make the values equal. Try this
instead...


Workbooks(wkb).Worksheets(CStr(Cell)).Range("WPCodeDescription").Value = _
Workbooks(WkbPrevious).Worksheets(CStr(Cell)).Range("WPCodeDescription").Value
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top