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.
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

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
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,881
Messages
5,834,226
Members
430,267
Latest member
Excel_User_4

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