vlookup and return entire cell including formatting from non active workbook

偶尔善良 提交于 2019-12-11 10:16:19

问题


I'm looking to vlookup a value from a tableArray on a different workbook and return the value and entire cells content.

This SO answer is nearly what I'm looking for.

If I amend this links copyFormatting routine (Private Sub copyFormatting(destCell As Range, srcCell As Range)) to copy the cell and paste all instead of formatting the cells font:

srcCell.Copy
destCell.PasteSpecial xlPasteAll

Then the code works as is when the return value is within the same workbook.

Any ideas how I can get the set range line -

fromCell.Parent.Range(destAddr)

to work when referencing a cell address in another workbooks sheet?


回答1:


Set extractDestRange = Range(destAddr) 'fromCell.Parent

commenting out the fromCell.Parent reference fixes this.



来源:https://stackoverflow.com/questions/25999153/vlookup-and-return-entire-cell-including-formatting-from-non-active-workbook

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!