VBA Check if value exists from one sheet then copy into row on sheet 2

mac1245

New Member
Joined
Feb 1, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hello I need help creating a VBA code as follows -


Sheet 1

ColorFoodDate OrdersDate OrdersDate Orders
RedCoke200172002820038
BlackSquare200162002-20033
Green Grapes2001-2002-2003-

Create Sheet 2
There is a template I need to follow for sheet 2 (need 6 rows for all, first two row has the same info, then middle rows is where the number of orders go in if there is an order for that year and then lastly 0 for all rows below) (Also if there are no orders of a particular type, just create one entry with a 0)

Red_Cokexyz # (Default - same for all) 0
Red_Cokeabc # (Default - same for all) 5
Red_Coke20017
Red_Coke20028
Red_Coke20038
Red_Coke00
Black_Squarexyz # (Default - same for all)0
Black_Squareabc # (Default - same for all)5
Black_Square20016
Black_Square20033
Black_Square00
Black_Square00
Green_Grapesxyz # (Default - same for all)0
Green_Grapesxyz # (Default - same for all)5
Green_Grapes20010
Green_Grapes00
Green_Grapes00
Green_Grapes00
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Any help would be appreciated. I started out with the initial part but am running into confusion with the for loop and just got stuck on how to proceed.
 
Upvote 0

Forum statistics

Threads
1,215,028
Messages
6,122,753
Members
449,094
Latest member
dsharae57

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