Hello all,
I found a macro that will copy and paste rows to a new sheet based on a certain condition, and then delete the rows from the parent sheet. However, I'd like to copy and paste *without* then deleting the rows.
I tried removing the delete function from the code, but it hangs up Excel and doesn't work.
Anyone have any suggestions?
Thanks,
Leif
Here's the code:
Sub resolution()
Dim xRg As Range
Dim xCell As Range
Dim I As Long
Dim J As Long
Dim K As Long
' Keyetta
' exchange "Keyetta" in row below with new sheet name
I = Worksheets("Keyetta").UsedRange.Rows.Count
J = Worksheets("Summary").UsedRange.Rows.Count
If J = 1 Then
If Application.WorksheetFunction.CountA(Worksheets("Summary").UsedRange) = 0 Then J = 0
End If
' exchange "Keyetta" in row below with new sheet name
Set xRg = Worksheets("Keyetta").Range("K1:K" & I)
On Error Resume Next
Application.ScreenUpdating = False
For K = 1 To xRg.Count
If CStr(xRg(K).Value) = "NO" Then
xRg(K).EntireRow.Copy Destination:=Worksheets("Summary").Range("A" & J + 1)
xRg(K).EntireRow.Delete
If CStr(xRg(K).Value) = "NO" Then
K = K - 1
End If
J = J + 1
End If
Next
Application.ScreenUpdating = True
' End code for Keyetta
End Sub
Bookmarks