更高效的多重复制/粘贴Excel VBA

时间:2019-06-14 04:17:32

标签: excel vba copy paste

我正在从工作表中复制形状数组,然后将其粘贴多次并粘贴到另一张表的单元格中(多达200次)。我遇到了严重的性能问题,并不断出现1004错误。我添加了一个PauseEvent可以帮助您,但是希望有人有一个聪明的想法可以优化。

Sheets("Images").Shapes.Range(Array("EthernetPorts")).Select
Selection.Copy
Sheets("Drawing Board").Select

For a = 0 To d

Set XRng = Rng.Offset(a, b)

PauseEvent (0.2)

Sheets("Drawing Board").Paste

With Selection

.Left = XRng.Left + (XRng.Width * 0.75): .Top = XRng.Top + (XRng.Height * 0.3): .Name = "Ethernet" & i

End With

With Sheets("Drawing Board").Shapes.Range(Array("LowPort"))
.Name = "EPortIn" & i
End With

With Sheets("Drawing Board").Shapes.Range(Array("HighPort"))
.Name = "EPortOut" & i
End With

i = i + 1

Next a

0 个答案:

没有答案