Arcticwarrio
Active Member
- Joined
- Dec 6, 2005
- Messages
- 439
Hi all,
i have this at the moment:
in a sheet named CURRENT is all our data.
when the jobs done the Satus Column "F" is changed to INVOICE
and then once a day or whenever they are all moved to a new sheet named the month and year, in this case JUN 09
this works fine as it is but at the moment i have to delete the lines myself from where it took the data from in CURRENT or AtoZ then remove them in 1 go.
Simply put, i want the code to remove these lines itself.
any ideas?
this is the code at the moment
i have this at the moment:
in a sheet named CURRENT is all our data.
when the jobs done the Satus Column "F" is changed to INVOICE
and then once a day or whenever they are all moved to a new sheet named the month and year, in this case JUN 09
this works fine as it is but at the moment i have to delete the lines myself from where it took the data from in CURRENT or AtoZ then remove them in 1 go.
Simply put, i want the code to remove these lines itself.
any ideas?
this is the code at the moment
Code:
Sub move()
Dim Cell As Range
Dim NextRow As Long
Dim ws1 As Worksheet
Dim ws2 As Worksheet
Set ws1 = Sheets("CURRENT")
Set ws2 = Sheets("JUN 09")
With ws2
NextRow = .Range("F65536").End(xlUp).Row + 1
For Each Cell In ws1.Range("F2:F10000")
If Cell.Value = "INVOICE" Then
NextRow = NextRow + 1
Cell.EntireRow.Cut Destination:=.Rows(NextRow)
'Cell.EntireRow.Delete
End If
Next Cell
End With
End Sub