Moving a Row when a condition is met

lolly81

New Member
Joined
Apr 29, 2022
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Hi

Total Newbie here and do not have a clue, so thank you in advance for any help you can give . I need to move a row to another part of spreadsheet when a condition is met, and when it pasted below it will go into the next blank row.

So once the status column reads Improvement met- i need the row to be pasted below on a similar blank table and this row cleared. Then this cycle to continue so that the tabe below its constantly added too, and the top only contains outstanding improvements. I hope this make sense

I have never done coding before so any help is much appreciated

thank you
ConcernsImprovement DateStatusComments
Blah blah01/01/2022Improvement MetBlah
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Hello Lolly,

I think by what you have said then you want to simply insert a new row.

The below macro does that - assuming 'Improvement Met' is in cell C2.

VBA Code:
Sub MoveRow()
    If Range("C2").Value = "Improvement Met" Then
    Rows("2:2").Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
    End If
End Sub

I'll send instructions to run it automatically soon. :) I just have to look after my daughter now.

Jamie
 
Upvote 0
Hello Lolly,

Right click on the worksheet tab, select 'view code' - copy and paste the code below.

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("C2")) Is Nothing Then
If Range("C2").Value = "Improvement Met" Then
Rows("2:2").Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
End If
End If
End Sub

That will insert a new row - move all the rows down.

No need for you to interact.

Jamie
 
Upvote 0
Solution
Hello Lolly,

Since you are a new member; if the solution works then if you mark the best answer with the tick/checkmark on the righthand side. Then others will see the solution if they have a similar answer; and nobody else needs to spend time answering it.

Glad to have helped.

Jamie
 
Upvote 0

Forum statistics

Threads
1,214,606
Messages
6,120,488
Members
448,967
Latest member
visheshkotha

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
Back
Top