PDA

View Full Version : Solved: If values in row cut/paste



Emoncada
07-30-2012, 07:34 AM
I have data on a sheet that gets updated daily.
What I need is to be able to have the user click the command button on the sheet and have it cut the rows that have values in Columns E & F
And paste them in the Sheets("Completed").

Then move the rows remaining up.

Any help would be great.

Emoncada
07-30-2012, 08:32 AM
I was able to locate this code that works with worksheet_change

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
'Change in Column G
If Target.Column <> 7 Then Exit Sub
If Target.Value > 0 Then
Application.ScreenUpdating = False
Application.EnableEvents = False
Dim myrow As Long
myrow = Target.Row
Target.EntireRow.Cut
Sheets("Completed").Range("A65536").End(xlUp).Offset(1, 0).Insert 'shift:=xlDown
Sheets("Sheet1").Range("A" & myrow).EntireRow.Delete
Application.ScreenUpdating = True
Application.EnableEvents = True
End If
End Sub

This does what I was looking for.
Hope this can help someone