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

Excel VBA Macro - Copy Cells and Paste Values to Active Cell Range

问题描述:

I am running into some problems with this Excel macro, as I'm pretty new to it.

I want to take various cells, copy them, then paste their values to the active cell and the cells below it.

For example, I have cell D2 currently selected. The values I want to copy when I run the macro are A1, B4, and C3. When I run the macro, I want to have the values of these cells paste to cells D2, D3, and D4, respectively.

Any help with this code would be greatly appreciated!

网友答案:

D2 would be:

Selection.Value = ActiveSheet.Range("A1").Value

D3 would use OFFSET:

Selection.Offset(1).Value = ActiveSheet.Range("B4").Value

So D4:

Selection.Offset(2).Value = ActiveSheet.Range("C3").Value
分享给朋友:
您可能感兴趣的文章:
随机阅读: