VBA问题:请问在EXCEL中如何批量插入复制的行?

2024-11-20 11:35:47
推荐回答(5个)
回答(1):

只有B列复制?
Sub charuhang()
j = 2 '若插入1行j=1,若插入两行,则碧戚链j=2....
m = 3
n = 26
For i = m To n
Rows(m + n + 1 - i & "悔孙:" & m + n + 1 - i).Select
For k = 1 To j
Selection.Insert Shift:=xlDown
Cells(m + n + 1 - i, 2) = Cells(m + n - i, 2)
Next k
Next i
End Sub
只加了一仔枯行

回答(2):

增数激加
Selection.Copy 在Selection.Insert Shift:=xlDown 之前 尝试一下……腔坦
我没有仔细看你的代码,如果你能实现插入 那么一旦复制了 就应该是插入复制伍毕桐的单元格……

回答(3):

Sub 宏燃郑1()
'族行
'皮穗颂 宏1 宏
'

'
myrow = 4
mycol = 2

For i = 1 To 24
Cells(myrow, mycol).Select
Selection.EntireRow.Insert , CopyOrigin:=xlFormatFromLeftOrAbove
Selection.EntireRow.Insert , CopyOrigin:=xlFormatFromLeftOrAbove
Cells(myrow, mycol) = Cells(myrow - 1, mycol)
Cells(myrow + 1, mycol) = Cells(myrow - 1, mycol)
myrow = myrow + 3
Next
End Sub

回答(4):

Sub aa()
Rows(Selection.Row & ":" & Selection.Row).Select
Selection.Copy
Selection.Insert Shift:=xlUp
Application.CutCopyMode = False
Selection.Copy
Selection.Insert Shift:=xlUp
Application.CutCopyMode = False
End Sub

回答(5):

用cells(行号,列号)赋值吧。