VB Script or Macro To Remove a row after it's copied to another sheet

T

tdemartino

With all your help I was able to create a script to copy rows based on
a "complete" value in column G to another sheet. (I've even used the
conditioning format to change cell color based on the value). But,
because I have 'sum' formulas w/totals I need to have these rows that
are copied removed. Is it possible. This is what I have:
Row 1: Total Anticipated Hours: (row 7 +8 in column C = 12)
A B C
D E F
(date) (Customer) (Hrs Anticipated) (Actual Hrs)
(Difference) (Completed)

this is where the

formula is C-D
7 6/25/06 SMITH 5 2
-3 6/27/06
8 6/25/06 Jones 7 8
1 6/27/06

Column G is a status of In-Progress or Complete, which is where the
copy script comes in to copy to sheet 2

Private Sub Worksheet_Change(ByVal Target As Range)
Dim cNextRow As Long
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("K1:K5000")) Is Nothing Then
With Target
If .Value = "Complete" Or .Value = "complete" Then
cNextRow = Worksheets("Completed").Cells(Rows.Count,
"A").End(xlUp).Row + 1
.EntireRow.Copy Worksheets("Completed").Cells(cNextRow,
"A")
End If
End With
End If


ws_exit:
Application.EnableEvents = True
End Sub

After the row(s) are copied to sheet2, how can I remove the rows
w/"complete" in the status, so my total anticipated hours are current
and don't have the complete still calculating.

Thanks,

TDee
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top