我需要帮助,我试图根据单元格值插入新行,还需要将值复制到新行, 这是代码,
Sub CopyData()
'Updateby Extendoffice 20160922
Dim xRow As Long
Dim VInSertNum As Variant
xRow = 1
Application.ScreenUpdating = False
Do While (Cells(xRow, "A") <> "")
VInSertNum = Cells(xRow, "B")
If ((VInSertNum > 1) And IsNumeric(VInSertNum)) Then
ActiveSheet.Unprotect
Range(Cells(xRow, "A"), Cells(xRow, "B")).Copy
ActiveSheet.Protect
Range(Cells(xRow + 1, "A"), Cells(xRow + VInSertNum - 1, "B")).Select
Selection.Insert Shift:=xlDown
xRow = xRow + VInSertNum - 1
End If
xRow = xRow + 1
Loop
Application.ScreenUpdating = False
End Sub
我从另一个网站获得了该代码,但我被困在Selection.Insert
这就是我想要的, enter image description here
之前感谢:)