[英]Excel VBA Macro - Copy and insert copied cells
我似乎無法勝任這項工作。 我一直卡在
Rows(rng 5).Select
我想要做的是復制活動單元格的行並將復制的單元格插入活動單元格下方 5 行的行中。
Sub CopyConcatenate()
Dim ws As Worksheet
Dim rng As Range
Set rng = ActiveCell.Rows
rng.Select
Selection.Copy
Rows(rng 5).Select
Selection.Insert Shift:=xlDown
End Sub
未經測試。
這是你正在嘗試的嗎?
Sub CopyConcatenate()
Dim ws As Worksheet
Dim rng As Range
'~~> Set this to the relevant worksheet
Set ws = ThisWorkbook.Sheets("Sheet1")
With ws
'~~> Set your range
Set rng = .Rows(ActiveCell.Row)
'~~> Copy the range
rng.Copy
'~~> Insert the range
rng.Offset(5).Insert Shift:=xlDown
'~~> Clear the clipboard. More importantly remove the
'~~> ant like borders
Application.CutCopyMode = False
End With
End Sub
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.