vlookup and return entire cell including formattin

2019-08-13 01:58发布

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?

标签: excel vba range
1条回答
The star\"
2楼-- · 2019-08-13 02:47

Set extractDestRange = Range(destAddr) 'fromCell.Parent

commenting out the fromCell.Parent reference fixes this.

查看更多
登录 后发表回答