I'm new to VBA but trying to learn and wrap my head around the way vba works. What I need can be seen below:
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Formula1[/TD]
[TD]Formula2[/TD]
[TD]Formula3[/TD]
[TD]Formula4[/TD]
[TD]1234[/TD]
[TD]Step1[/TD]
[TD]Step2[/TD]
[TD]Step3[/TD]
[TD]DOG[/TD]
[TD]Complete[/TD]
[/TR]
[TR]
[TD]Formula1[/TD]
[TD]Formula2[/TD]
[TD]Formula3[/TD]
[TD]Formula4[/TD]
[TD]5678[/TD]
[TD]Step1[/TD]
[TD]Step2[/TD]
[TD][/TD]
[TD]DOG[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Formula1[/TD]
[TD]Formula2[/TD]
[TD]Formula3[/TD]
[TD]Formula4[/TD]
[TD]4321[/TD]
[TD]Step1[/TD]
[TD]Step2[/TD]
[TD][/TD]
[TD]DOG[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Formula1[/TD]
[TD]Formula2[/TD]
[TD]Formula3[/TD]
[TD]Formula4[/TD]
[TD]8765[/TD]
[TD]Step1[/TD]
[TD][/TD]
[TD][/TD]
[TD]DOG[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Formula1[/TD]
[TD]Formula2[/TD]
[TD]Formula3[/TD]
[TD]Formula4[/TD]
[TD]2468[/TD]
[TD]Step1[/TD]
[TD]Step2[/TD]
[TD]Step3[/TD]
[TD]CAT[/TD]
[TD]Complete[/TD]
[/TR]
[TR]
[TD]Formula1[/TD]
[TD]Formula2[/TD]
[TD]Formula3[/TD]
[TD]Formula4[/TD]
[TD]1359[/TD]
[TD]Step1[/TD]
[TD]Step2[/TD]
[TD][/TD]
[TD]CAT[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Formula1[/TD]
[TD]Formula2[/TD]
[TD]Formula3[/TD]
[TD]Formula4[/TD]
[TD]8642[/TD]
[TD]Step1[/TD]
[TD][/TD]
[TD][/TD]
[TD]CAT[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
This table represents a status of open orders in a spreadsheet. I'd like to create a button that when clicked, finds the last occurrence of "Cat" or "Dog" (which I will tell it), copy the last row of that occurrence, and paste it as a new row below the last. Note: the blank row inbetween DOG and CAT is important and must stay. I'd also like it to copy the formulas from Cells 1-4.
How best would you do set up the vba? My thought is to do these steps in this order:
1) inputBox pops up for the user to enter the PO number (1234, 4321 found above).
2) find last occurrence of Dog
3) Copy row of last occurrence of dog
4) Insert Copied cells from step above
5) if "Step2, Step3 or "Complete" are filled in, make those cells blank.
These are the steps I would take if I were manually adding a new row but I feel like VBA may have some ways to accomplish it without all of those steps needed.
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Formula1[/TD]
[TD]Formula2[/TD]
[TD]Formula3[/TD]
[TD]Formula4[/TD]
[TD]1234[/TD]
[TD]Step1[/TD]
[TD]Step2[/TD]
[TD]Step3[/TD]
[TD]DOG[/TD]
[TD]Complete[/TD]
[/TR]
[TR]
[TD]Formula1[/TD]
[TD]Formula2[/TD]
[TD]Formula3[/TD]
[TD]Formula4[/TD]
[TD]5678[/TD]
[TD]Step1[/TD]
[TD]Step2[/TD]
[TD][/TD]
[TD]DOG[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Formula1[/TD]
[TD]Formula2[/TD]
[TD]Formula3[/TD]
[TD]Formula4[/TD]
[TD]4321[/TD]
[TD]Step1[/TD]
[TD]Step2[/TD]
[TD][/TD]
[TD]DOG[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Formula1[/TD]
[TD]Formula2[/TD]
[TD]Formula3[/TD]
[TD]Formula4[/TD]
[TD]8765[/TD]
[TD]Step1[/TD]
[TD][/TD]
[TD][/TD]
[TD]DOG[/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Formula1[/TD]
[TD]Formula2[/TD]
[TD]Formula3[/TD]
[TD]Formula4[/TD]
[TD]2468[/TD]
[TD]Step1[/TD]
[TD]Step2[/TD]
[TD]Step3[/TD]
[TD]CAT[/TD]
[TD]Complete[/TD]
[/TR]
[TR]
[TD]Formula1[/TD]
[TD]Formula2[/TD]
[TD]Formula3[/TD]
[TD]Formula4[/TD]
[TD]1359[/TD]
[TD]Step1[/TD]
[TD]Step2[/TD]
[TD][/TD]
[TD]CAT[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Formula1[/TD]
[TD]Formula2[/TD]
[TD]Formula3[/TD]
[TD]Formula4[/TD]
[TD]8642[/TD]
[TD]Step1[/TD]
[TD][/TD]
[TD][/TD]
[TD]CAT[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
This table represents a status of open orders in a spreadsheet. I'd like to create a button that when clicked, finds the last occurrence of "Cat" or "Dog" (which I will tell it), copy the last row of that occurrence, and paste it as a new row below the last. Note: the blank row inbetween DOG and CAT is important and must stay. I'd also like it to copy the formulas from Cells 1-4.
How best would you do set up the vba? My thought is to do these steps in this order:
1) inputBox pops up for the user to enter the PO number (1234, 4321 found above).
2) find last occurrence of Dog
3) Copy row of last occurrence of dog
4) Insert Copied cells from step above
5) if "Step2, Step3 or "Complete" are filled in, make those cells blank.
These are the steps I would take if I were manually adding a new row but I feel like VBA may have some ways to accomplish it without all of those steps needed.