Hi all,
could someone help me mod this to delete each blank row after it has moved the data to another sheet. Currently, it works when there is only one "Y" marked row but, if there are multiple rows, it does not delete any of the blank rows.
thanks in advance
could someone help me mod this to delete each blank row after it has moved the data to another sheet. Currently, it works when there is only one "Y" marked row but, if there are multiple rows, it does not delete any of the blank rows.
Code:
Sub Move_Closed()Dim Check As Range, rng As Range, r As Long, lastrow2 As Long, lastrow As Long
Application.ScreenUpdating = False
lastrow = Worksheets("Open").UsedRange.Rows.Count
lastrow2 = Worksheets("Completed").UsedRange.Rows.Count
If lastrow2 = 1 Then lastrow2 = 0
For r = lastrow To 2 Step -1
If Range("F" & r).Value = "Y" Then
Rows(r).Cut Destination:=Worksheets("Completed").Range("A" & lastrow2 + 1)
If rng Is Nothing Then Set rng = Rows(r) Else Set rng = Union(rng, Rows(r))
lastrow2 = lastrow2 + 1
Else:
End If
Next r
If Not rng Is Nothing Then rng.Delete
Application.ScreenUpdating = True
End Sub
thanks in advance