Copy rows of cells dependent on expiry dates(or colour of cells) to a new sheet

benignmalice

New Member
Joined
Dec 13, 2021
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi guys,

I have been struggling for quite a while now to figure out a way to automatically copy and paste rows of data (according to an expiry date or colour of a cell) to new sheets. I have seen a few macros for similar problems posted but haven't been able to get them to work with my spreadsheet.

I have a spreadsheet of medication stock. What I need to do is copy the medication rows which are currently expired to a new sheet, I also need to copy the medications that are going to expire within 2 months to a different sheet, and finally the medication expiring between 2 - 4months to a different sheet. The expiry date cell has been conditionally formatted to change colour depending on the duration to the expiry date. Is it possible to automatically copy and paste cells dependent on their colour?

I have another sheet of medical consumables which I have to do the same thing with but is has a different cell number with the expiry date.

Please could someone kindly assist me with a macro or give me pointers on how to go about getting this done. It would be massively appreciated!

I hope this explanation is clear enough. If you need any further info please let me know.
 

Attachments

  • 2021-12-13 (4).png
    2021-12-13 (4).png
    242.1 KB · Views: 35
  • 2021-12-13 (3).png
    2021-12-13 (3).png
    254.6 KB · Views: 36

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.

Saurabhj

Well-known Member
Joined
Jun 6, 2020
Messages
643
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi, please use XL2BB tool to share your data. It would help to provide solution quickly.

thanks,
Saurabh
 

benignmalice

New Member
Joined
Dec 13, 2021
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi,

Thanks for the reply. I am unfortunately not able to share the document as it is work related. What other information do you need to make it easier to assist?
 
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,164,133
Messages
5,835,594
Members
430,369
Latest member
pingel

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