Macro to move rows to another sheet based on cell value

JarredE

New Member
Joined
Jul 12, 2017
Messages
9
Hi all, You've been incredibly helpful and kind to this point, and I need to rely on that kindness one more time.

I need a macro that will check a certain cell for a value, and upon finding that value, cut the entire row and paste it into a different sheet, then delete the now-empty row from the sheet.

The main sheet is called 'Diversion Notes'.

In Column D there are cells between row 5 and 104 with a drop down which has the options "Select", "Diverted", and "Admitted".

I need a macro I can link to a button that when clicked, checks the cells between D5 and D104 on worksheet 'Diversion Notes'.

If "Select" is in the cell, do nothing.

If "Diverted" is in the cell, cut the entire row containing that cell, and paste in the sheet 'FYTD Diversions' in the next available row in that sheet, which has the exact same formatting (number of columns, column headers, etc. as the 'Diversion Notes' sheet). Like the initial sheet, data begins in row 5 when that sheet is blank. Then the macro should delete the now-empty row from 'Diversion Notes'.

If "Admitted" is in the cell, do the exact same thing but paste the row into the next available row in the sheet 'FYTD Admissions'.

I've seen code that can do this, but unfortunately I'm lost when it comes to where to change the sheet names, cells to check, etc. within the code. I've tried a couple of times and it hasn't worked or it's done something completely unintended.

I know it's a big ask. Thanks in advance!
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Forum statistics

Threads
1,215,523
Messages
6,125,318
Members
449,218
Latest member
Excel Master

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