我正在努力通过使用偏移来粘贴我的范围。以下是我的代码。
Sub Button1_Click()
Dim i As Integer
Dim rng As Range
Dim curCell As Range
'Insert row for Child 2 data
Set rng = Range("H2:H5000")
For counter = 2 To 10000
Set curCell = Worksheets("Sheet1").Cells(counter, 8)
If curCell.Value <> "" Then
curCell.EntireRow.Select
Selection.Copy
Selection.Insert Shift:=xlDown
Range(curCell, curCell.Offset(0, 1)).Copy
ActiveCell.Offset(, -2).Select
Selection.Paste
counter = counter + 1
End If
Next counter
ActiveCell.Offset(, -2).Select
错误。我正在尝试粘贴我复制的范围。