I have a parts list (multi level explosion) that is several thousand lines long. Doing this by hand would be pretty excruciating. I know this can be done with VBA I am just not sure how. I think this should actually be pretty simple to do.
Basically there are different "levels". Level 1 is the highest assembly. Level 2 is the next assembly/parts that go INTO the Level 1 assembly. Level 3 would go into Level 2 and so on.
I need help creating a code that will copy and paste the appropriate Part Number and Serial Number into the Next Higher Assembly Part Number and Next Higher Assembly Serial Number columns based on the appropriate levels. Take a look at my two attached photos. The first photo shows a small sample of the current state. The second photo shows what I want the program to do.
I think what I am trying to accomplish should be pretty clear from the photos...but in the sake of explaining it further here is what I "think" the program needs to do from a logic standpoint:
Alright guys I am still looking for some help. I thought about this all night and I am thinking if I can just get help with a few functions I can probably figure this out. Here is what I am thinking the programming structure should look like:
1. Start VBA program on cell A2 'column A is where the levels are
2. If value in current cell = "1" then move down to next row (A3) 'since there are no levels above level 1 we don't need to do anything
3. If value in current cell = "2" then SEARCH rows above for the FIRST "1"
4. If value in current cell = "3" then SEARCH rows above for the FIRST "2"
5. If value in current cell = "4" then SEARCH rows above for the FIRST "3"
6. If value in current cell = "5" then SEARCH rows above for the FIRST "4"
7. Copy cell contents in column E,D,F 'I am adding in Revision to this now thus the need for column F
8. Return to previous cell and paste values into B,C,D
9. Move down to next row and repeat process
Does the above make sense? What function in VBA would I use to SEARCH the rows ABOVE for certain values? And then how would I return to row I was in to paste the values? Can this be done?
Just in case you CAN'T see the attached photos here is a link to my Google Photos where you should be able to view them:
https://goo.gl/photos/TFxjczkSCmrEyHAV9
Bookmarks