How to move a row from one worksheet to another based on a met value

verlander1

New Member
Joined
Jun 4, 2015
Messages
10
Hi,
I'm having trouble and need help
I have to move a row from a sheet called "Continuous Improvement Form" to "Archived Continuous Improvement" when the value in column J equals 100 and I also need the row it was in, in the "Continuous Improvement Form" to delete and the contents of that sheet to all move up one row.
I know this requires a macro and I've tried to write one and use similar codes I found online as a template but I'm pretty bad at code. Any help would be appreciated. Thanks.
 

Some videos you may like

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Stridhan

Well-known Member
Joined
Mar 5, 2014
Messages
568
paste in codewindow for sheet "Continuous Improvement Form"

try in a copy
Code:
Private Sub Worksheet_Change(ByVal Target As Range)

Dim lr As Integer, x As Integer
Dim Cws As Worksheet
Dim Aws As Worksheet
On Error GoTo myExit
Set Aws = ThisWorkbook.Sheets("Archived Continuous Improvement")
Set Cws = ThisWorkbook.Sheets("Continuous Improvement Form")
lr = Cws.Cells(Rows.Count, "J").End(xlUp).Row
Application.EnableEvents = False
For x = lr To 2 Step -1
    If Cells(x, "J").Value = 100 Then
        Cws.Rows(x).EntireRow.Copy Aws.Range("A" & Aws.Cells(Rows.Count, "J").End(xlUp).Row).Offset(1)
        Cws.Rows(x).Delete shift:=xlUp
    End If
Next x
myExit:
Application.EnableEvents = True
End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,122,721
Messages
5,597,758
Members
414,171
Latest member
12Rev79

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top