开发者

Copy excel (2007) sheet to new workbook without formulas referencing original workbook

I have a workbook with two sheets. The first is full of data and calculations, the second is mostly cells with references to the first sheet. The second sheet also concatenates strings, and references to cells in the sheet, to form SQL commands used elsewhere.

There is also a second workbook (soon to be more). It has a sheet identical to the first sheet of the other workbook, except with different data. The problem I'm having is that the new workbook needs a sheet similar to the second of the original workbook (sorry if this is sounding confusing). I would like to simply duplicate the sheet and its formulas, which I tried using the 'move or copy...' option. Unfortunately, the formulas in the cells reference the first sheet from the old workbook, like this: =[foobar.xlsx]data!A1. Way too much data to remove them by hand. I can't just redo the formulas because I had to remove a lot of specific lines from the second sheet, so dragging the formula would not match up correctly. I'm currently trying to hack this together with REPLACE but if anyone can offer help it would be greatly appreciated.

CLARIFICATION: When 开发者_如何学编程I copy the sheet, a formula will appear as =[foobar.xlsx]data!A1. I want it to just be data!A1.

Thanks :)


I hope this answers your problem, but I am a little unclear on your need!!!

Highlight all cells in the worksheet. Perform a replace to replace = with say '= This stops the formulas "being formulas" Copy the sheet. Perform another replace on the new sheet to replace '= with = This converts back to formulas, referring to cells in your new workbook.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜