Automatically move row to new tab when expiry date is reached

brodiej

New Member
Joined
May 29, 2023
Messages
6
Office Version
  1. 365
Platform
  1. MacOS
Hi everyone,

I am very new to VBA and have tried to look at previous posts, but I've ended up more confused that I was to start with! I am creating a chemical inventory list, to help us keep track of expired products. I have a separate tab for each room in which chemicals are kept, and one tab titled "waste". I would like to automatically move rows when the expiration date is met, however, I would like to only move some of the columns of each row. I have included a screenshot of one of my tabs, as well as the waste tab, where I would like the expired product to go.

So, I would like excel to move the row in tab "Stores" based on the date in K to the tab "Waste". I would like to move column C to B, G to E, H to F, I to G, J to H, and L to I (from stores to waste)


I apologise in advance for being such a beginner! Really appreciate any help, Thank you :)
 

Attachments

  • Stores tab .jpg
    Stores tab .jpg
    100.6 KB · Views: 9
  • Waste Tab.jpg
    Waste Tab.jpg
    63.2 KB · Views: 10

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Did you consider using a helper column to flag the expired material as expired? A simple formula in that column would fill in with whatever you want. Something like
If(K9<=Now(),"EXPIRED", "")
 
Upvote 0
Hi, yes I have already used conditional formatting to automatically highlight the cells when expired. I would like to move them to another tab once expired as it means our waste sheet will be automatically completed and we can send it straight off for collection.
 
Upvote 0
Can help you help others to help you, but I think that's just about it given the scope of the work as I see it (I'm a novice at Excel vba, not so with Access vba). I suggest you post real data, either as copy/paste or better, use xl2bb tool. If people had something to work with, you might garner more responses. Pictures are often good, but they require that responders manually recreate your tabs and all the data you show. You might also be asked if there is an correlation between item number column in the 2 sheets. I'm guessing not. FWIW, I find that a bit misleading/confusing. Given the goal, item 1 in stores tab and item 1 in waste tab won't necessarily be related, but the duplicate column names suggests otherwise.
 
Upvote 0
Can help you help others to help you, but I think that's just about it given the scope of the work as I see it (I'm a novice at Excel vba, not so with Access vba). I suggest you post real data, either as copy/paste or better, use xl2bb tool. If people had something to work with, you might garner more responses. Pictures are often good, but they require that responders manually recreate your tabs and all the data you show. You might also be asked if there is an correlation between item number column in the 2 sheets. I'm guessing not. FWIW, I find that a bit misleading/confusing. Given the goal, item 1 in stores tab and item 1 in waste tab won't necessarily be related, but the duplicate column names suggests otherwise.
Hi, Okay, I will try and provide more data, thank you for the advice. I understand it is a little confusing, I did my best to explain it! The item number has no correlation between the tabs, just a way for us to quickly see how many items are in each location :)
 
Upvote 0
Hi, Okay, I will try and provide more data, thank you for the advice. I understand it is a little confusing, I did my best to explain it! The item number has no correlation between the tabs, just a way for us to quickly see how many items are in each location :)

Tab 1: Stores
Chem Inventory Test.xlsx
ABCDEFGHIJKLM
9Item No.Location Within RoomChemicalNameDescriptionCompanyCatLotContainer TypeNo. of containersContainer size(g,µl,ml,kg,l)Physical StateExpiryContainer empty?Hazard Properties HP1-HP15(List all applicable) SEE TAB 2
101Chemical BayChemical 1Comp 1Cat 1Lot 1Plastic11Powder11/1/25No
112Chemical BayChemical 2Comp 2Cat 2Lot 2Plastic11PowderRetest 2025No
123Chemical BayChemical 3Comp 3Cat 3Lot 3Plastic11LiquidNANo
Test
Cells with Conditional Formatting
CellConditionCell FormatStop If True
L10:L903Cell Valuecontains "Yes"textNO
K10:K544Expression=$K10<TODAY()textNO
Cells with Data Validation
CellAllowCriteria
L10:L12ListYes, No
J10:J12ListSolid, Liquid, Gas, Powder, Mixed
G10:G12ListPlastic, Glass, Cardboard, Metal



Tab 2: Waste
Chem Inventory Test.xlsx
ABCDEFGHI
9Item No.Chemical Name or Description of WasteComponentsConcentrationContainer TypeNo. of containersContainer size(g,µl,ml,kg,l)Physical StateHazard Properties HP1-HP15(List all applicable) SEE TAB 2
10Required for volumes >5l
111
122
133
Waste
Cells with Data Validation
CellAllowCriteria
H11:H13ListSolid, Liquid, Gas, Powder, Mixed
 
Upvote 0
Tab 1: Stores
Chem Inventory Test.xlsx
ABCDEFGHIJKLM
9Item No.Location Within RoomChemicalNameDescriptionCompanyCatLotContainer TypeNo. of containersContainer size(g,µl,ml,kg,l)Physical StateExpiryContainer empty?Hazard Properties HP1-HP15(List all applicable) SEE TAB 2
101Chemical BayChemical 1Comp 1Cat 1Lot 1Plastic11Powder11/1/25No
112Chemical BayChemical 2Comp 2Cat 2Lot 2Plastic11PowderRetest 2025No
123Chemical BayChemical 3Comp 3Cat 3Lot 3Plastic11LiquidNANo
Test
Cells with Conditional Formatting
CellConditionCell FormatStop If True
L10:L903Cell Valuecontains "Yes"textNO
K10:K544Expression=$K10<TODAY()textNO
Cells with Data Validation
CellAllowCriteria
L10:L12ListYes, No
J10:J12ListSolid, Liquid, Gas, Powder, Mixed
G10:G12ListPlastic, Glass, Cardboard, Metal



Tab 2: Waste
Chem Inventory Test.xlsx
ABCDEFGHI
9Item No.Chemical Name or Description of WasteComponentsConcentrationContainer TypeNo. of containersContainer size(g,µl,ml,kg,l)Physical StateHazard Properties HP1-HP15(List all applicable) SEE TAB 2
10Required for volumes >5l
111
122
133
Waste
Cells with Data Validation
CellAllowCriteria
H11:H13ListSolid, Liquid, Gas, Powder, Mixed
So, Move (from stores to waste) C to B, G to E, H to F, I to G, J to H, M to I
 
Upvote 0

Forum statistics

Threads
1,215,045
Messages
6,122,830
Members
449,096
Latest member
Erald

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