简体   繁体   中英

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM