Hi everyone,
I have been programming vba for a couple months now and have gotten a lot of help from this forum, though there is one question which has arisen and which I can't find the answer to.
In a new workbook I am copying a worksheet from another workbook with the usual lines
Workbooks(filenameToCopyFrom).Sheets("Data").Copy _
before:=Workbooks(filenameToPasteIn).Sheets(1)
and the sheet "Data" contains many arrays with names which I would like to continue to use in the workbook "filenameToPasteIn". When I copy using the above lines, all the references of the arrays in the new workbook refer to the old workbook like:
"='[filenameToCopyFrom.xls]Data'!$A$12:$B$5010"
when I actually would like the names to refer to the exakt same location BUT in the new workbook's sheet "Data":
"='[filenameToPasteIn.xls]Data'!$A$12:$B$5010" which of course could be without the filenameToPasteIn.xls in front of it..
How can i copy while not having the names referring to the old worksheet but the new one?
Thankful for any help!
/Stefan
Bookmarks