Hi,
I have written a sub with the purpose of finding rows based on a critieria, copying the rows to another worksheet and deleting the original row.
The code:
I get the error message "Method 'Delete' of object 'Range' failed" at the line "Sheets("Pipeline").Cells(3 + i, 18).EntireRow.Delete".
The sub has previously worked perfectly fine.
Really hope someone can help me out on this.
I have written a sub with the purpose of finding rows based on a critieria, copying the rows to another worksheet and deleting the original row.
The code:
Code:
Sub MoveToIgangvaerende()
'
' Flytter opgaven til sheetet Igangværende projekter
'
Dim i, j, Index As Integer
Forfra:
For i = -1 To 1000
If Sheets("Pipeline").Cells(3 + i, 20) = "Ja" Or Sheets("Pipeline").Cells(3 + i, 20) = "ja" Then
Sheets("Pipeline").Select
Cells(3 + i, 14) = 1
Cells(3 + i, 18).EntireRow.Select
Selection.Cut
Sheets("Igangværende").Select
For j = 1 To 1000
If IsEmpty(Cells(3 + j, 1)) Then
Cells(3 + j, 1).EntireRow.Select
Selection.Insert Shift:=xlDown
Index = j
j = 1000
End If
Next j
Cells(Index, 14) = 1
'Cells(Index, 15) = 0
Sheets("Pipeline").Cells(3 + i, 18).EntireRow.Delete
GoTo Forfra
End If
Next i
End Sub
I get the error message "Method 'Delete' of object 'Range' failed" at the line "Sheets("Pipeline").Cells(3 + i, 18).EntireRow.Delete".
The sub has previously worked perfectly fine.
Really hope someone can help me out on this.