cut and paste row

kenpcli

Board Regular
Joined
Oct 24, 2017
Messages
129
Is there a way to look down column C and remove the row and paste to the bottom if a certain name appears? ie if any cell in column C has "Totals for SELF PAY", it would cut the row and place it at the bottom and keep going down the work sheet?
 

Some videos you may like

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
52,921
Office Version
  1. 365
Platform
  1. Windows
How about
Code:
Sub SelfPay()

   Dim Ar As Areas
   Dim Rng As Range
   
   With Columns(3)
      .Replace "Totals For SELF PAY", True, xlWhole, , False, , False, False
      Set Ar = .SpecialCells(xlConstants, xlLogical).Areas
      .Replace True, "Totals For SELF PAY", xlWhole, , False, , False, False
   End With
   For Each Rng In Ar
      Rng.EntireRow.Copy Range("[COLOR=#ff0000]B[/COLOR]" & Rows.Count).End(xlUp).Offset(1, -1)
      Rng.EntireRow.Delete
   Next Rng
End Sub
This uses col B to find the last used rows, change if needed
 

kenpcli

Board Regular
Joined
Oct 24, 2017
Messages
129
How about
Code:
Sub SelfPay()

   Dim Ar As Areas
   Dim Rng As Range
   
   With Columns(3)
      .Replace "Totals For SELF PAY", True, xlWhole, , False, , False, False
      Set Ar = .SpecialCells(xlConstants, xlLogical).Areas
      .Replace True, "Totals For SELF PAY", xlWhole, , False, , False, False
   End With
   For Each Rng In Ar
      Rng.EntireRow.Copy Range("[COLOR=#ff0000]B[/COLOR]" & Rows.Count).End(xlUp).Offset(1, -1)
      Rng.EntireRow.Delete
   Next Rng
End Sub
This uses col B to find the last used rows, change if needed


Thank you, worked like a charm!
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
52,921
Office Version
  1. 365
Platform
  1. Windows
Glad to help & thanks for the feedback

PS
You do not need to quote the posts all the time, it messes up the thread.
As a rough rule of thumb
If you are replying to the previous post no quote is needed
If you are replying to an older post, only quote what is needed.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,499
Messages
5,596,515
Members
414,074
Latest member
Matthew Kakde

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