Thursday, 22 August 2013

Copy Excel formulas from one workbook to another using VBA and maintaining the names that already exist

Copy Excel formulas from one workbook to another using VBA and maintaining
the names that already exist

I'm using this code to copy formulas from one workbook to another.
For Each r In
templateWbk.Sheets("BSC").Cells.SpecialCells(xlCellTypeFormulas)
addressRange = r.Address
r.Copy instanceWbk.Sheets("BSC").Range(addressRange)
Next
Occationally I get a popup that says "The name "xxxxx" already exists.
Click Yes to use that version of the name, or click No to rename the
version of "xxxxx" you're moving or copying.
I don't want this popup to appear. I always want the exact content of the
cells to be copied and nothing more, in other words I want to use the
existing version of the name. This is the major thing I need help with.
The code is also rather slow as the sheets have many formulas. So if you
can suggest a faster approach I would be thankful for that as well.

No comments:

Post a Comment