当前位置: 动力学知识库 > 问答 > 编程问答 >

Paste using SendKeys not going to Excel

问题描述:

I am trying to simply paste into a cell in Excel. But instead it pastes into my VBA code editor.

Application.Worksheets("ABC").Cells(6, 86).Select

Application.SendKeys "^(v)", True

Appreciate help!

网友答案:

Why Sendkeys?

Sendkeys is highly unreliable. Why not this?

 Worksheets("ABC").Cells(6, 86).PasteSpecial xlPasteAll
网友答案:

You probably need a DoEvents:

Sub demo()
    Range("A1").Select
    Application.SendKeys ("^c")
    DoEvents
    Range("B9").Select
    Application.SendKeys ("^v")
End Sub
分享给朋友:
您可能感兴趣的文章:
随机阅读: