我正在编写用于创建组织结构图的代码,希望能够将表格中的源单元格的颜色粘贴到组织结构图中。当前目标单元格格式是从预设格式("chartformat")驱动的。下面的代码。任何帮助都将不胜感激。
' Put Preformula
Range("preformula").Copy
Range("finalarea").PasteSpecial Paste:=xlPasteFormulas
Application.CutCopyMode = False
Sheets("Org Chart").Calculate
' Clear Blanks
Range("finalarea").SpecialCells(xlCellTypeFormulas, 4).ClearContents
' Put Format
Range("chartformat").Copy
Range("finalarea").SpecialCells(xlCellTypeFormulas, 2).PasteSpecial Paste:=xlPasteFormats
' Put Formula and Clear
Range("chartformula").Copy
Range("finalarea").PasteSpecial Paste:=xlPasteFormulas
Sheets("Org Chart").Calculate
Range("finalarea").Copy
Range("finalarea").PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
https://stackoverflow.com/questions/51813057
复制相似问题