我正在获取Method' Range'对象' _Global'在以下代码的下面一行失败。
Dim myRange As String
For c = 7 To ioFileLastRow Step 1
If Left(ioFilePreEx.Cells(c, 21), 4) <> "DIVD" Then
myRange = myRange & "," & c & ":" & c
End If
Next c
Range(Left(myRange, Len(myRange) - 1)).Cut Destination:=ioFilePreEx1.Range("A" & ioFileLastRow).End(xlUp).Offset(1) 'Error Occurs Here
End Sub
请帮忙。 谢谢!
答案 0 :(得分:0)
Dim myRange As String
c = 7
Do Until ioFilePreEx.Cells(c, 1).Value = vbNullString
If ioFilePreEx.Cells(c, 21) <> "DIVD" Then
myRange = myRange & "," & c & ":" & c
End If
c = c + 1
Loop
ioFilePreEx.Range(Mid(myRange, 2)).Copy Destination:=ioFilePreEx1.Range("A"
& ioFileLastRow).End(xlUp).Offset(1, 0)
ioFilePreEx.Range(Mid(myRange, 2)).Delete
End Sub