Greetings,
We're working with parts-lists exported to xlsx format. These are huge but get "cropped" down to relevant data with a macro. Here's an example how the sheet looks like after applying the macro.
Sometimes parts on Level 3 are exchanged and hence have a negative value. I want to modify the macro so that the associated assembly on Level 2 (always above Level 3 parts, might call it a "parent" cell/row even) gets highlighted in red when at least one "child cell" has a negative value. Negative values on other "Levels" should be ignored however. The result ideally would look like this:
After this process all Level 3 parts get removed from the list, but we already have working code for that.
I would greatly appreciate any help in regards to the problem above.
SY24
We're working with parts-lists exported to xlsx format. These are huge but get "cropped" down to relevant data with a macro. Here's an example how the sheet looks like after applying the macro.
AssemblyStructure | |||||||
---|---|---|---|---|---|---|---|
A | B | C | D | E | |||
1 | Level | Pos. | Part / Assy No. | Part / Assy Name | Amount | ||
2 | 1......... | 1 | SAMPLENO | SAMPLENAME | 1,000 | ||
3 | .2........ | 1 | SAMPLENO | SAMPLENAME | 1,000 | ||
4 | .2........ | 2 | SAMPLENO | SAMPLENAME | 2,000 | ||
5 | .2........ | 3 | SAMPLENO | SAMPLENAME | 1,000 | ||
6 | ..3....... | 1 | SAMPLENO | SAMPLENAME | 1,000 | ||
7 | ..3....... | 2 | SAMPLENO | SAMPLENAME | -3,000 | ||
8 | ..3....... | 3 | SAMPLENO | SAMPLENAME | -6,000 | ||
9 | ..3....... | 4 | SAMPLENO | SAMPLENAME | 0,200 | ||
10 | .2........ | 4 | SAMPLENO | SAMPLENAME | 1,000 | ||
11 | ..3....... | 1 | SAMPLENO | SAMPLENAME | 1,000 | ||
12 | ..3....... | 2 | SAMPLENO | SAMPLENAME | 2,000 | ||
13 | ..3....... | 3 | SAMPLENO | SAMPLENAME | 1,000 | ||
14 | .2........ | 5 | SAMPLENO | SAMPLENAME | 1,000 | ||
15 | |||||||
16 | .2........ | 6 | SAMPLENO | SAMPLENAME | -1,000 | ||
17 | .2........ | 7 | SAMPLENO | SAMPLENAME | 2,000 | ||
18 | ..3....... | 1 | SAMPLENO | SAMPLENAME | 1,000 | ||
19 | ..3....... | 2 | SAMPLENO | SAMPLENAME | 1,000 | ||
20 | ..3....... | 3 | SAMPLENO | SAMPLENAME | -1,000 | ||
21 | ..3....... | 4 | SAMPLENO | SAMPLENAME | 1,000 | ||
22 | ..3....... | 5 | SAMPLENO | SAMPLENAME | 2,000 | ||
Sheet1 |
Sometimes parts on Level 3 are exchanged and hence have a negative value. I want to modify the macro so that the associated assembly on Level 2 (always above Level 3 parts, might call it a "parent" cell/row even) gets highlighted in red when at least one "child cell" has a negative value. Negative values on other "Levels" should be ignored however. The result ideally would look like this:
AssemblyStructure | |||||||
---|---|---|---|---|---|---|---|
A | B | C | D | E | |||
1 | Level | Pos. | Part / Assy No. | Part / Assy Name | Amount | ||
2 | 1......... | 1 | SAMPLENO | SAMPLENAME | 1,000 | ||
3 | .2........ | 1 | SAMPLENO | SAMPLENAME | 1,000 | ||
4 | .2........ | 2 | SAMPLENO | SAMPLENAME | 2,000 | ||
5 | .2........ | 3 | SAMPLENO | SAMPLENAME | 1,000 | ||
6 | ..3....... | 1 | SAMPLENO | SAMPLENAME | 1,000 | ||
7 | ..3....... | 2 | SAMPLENO | SAMPLENAME | -3,000 | ||
8 | ..3....... | 3 | SAMPLENO | SAMPLENAME | -6,000 | ||
9 | ..3....... | 4 | SAMPLENO | SAMPLENAME | 0,200 | ||
10 | .2........ | 4 | SAMPLENO | SAMPLENAME | 1,000 | ||
11 | ..3....... | 1 | SAMPLENO | SAMPLENAME | 1,000 | ||
12 | ..3....... | 2 | SAMPLENO | SAMPLENAME | 2,000 | ||
13 | ..3....... | 3 | SAMPLENO | SAMPLENAME | 1,000 | ||
14 | .2........ | 5 | SAMPLENO | SAMPLENAME | 1,000 | ||
15 | |||||||
16 | .2........ | 6 | SAMPLENO | SAMPLENAME | -1,000 | ||
17 | .2........ | 7 | SAMPLENO | SAMPLENAME | 2,000 | ||
18 | ..3....... | 1 | SAMPLENO | SAMPLENAME | 1,000 | ||
19 | ..3....... | 2 | SAMPLENO | SAMPLENAME | 1,000 | ||
20 | ..3....... | 3 | SAMPLENO | SAMPLENAME | -1,000 | ||
21 | ..3....... | 4 | SAMPLENO | SAMPLENAME | 1,000 | ||
22 | ..3....... | 5 | SAMPLENO | SAMPLENAME | 2,000 | ||
Sheet1 |
After this process all Level 3 parts get removed from the list, but we already have working code for that.
AssemblyStructure | |||||||
---|---|---|---|---|---|---|---|
A | B | C | D | E | |||
1 | Level | Pos. | Part / Assy No. | Part / Assy Name | Amount | ||
2 | 1......... | 1 | SAMPLENO | SAMPLENAME | 1,000 | ||
3 | .2........ | 1 | SAMPLENO | SAMPLENAME | 1,000 | ||
4 | .2........ | 2 | SAMPLENO | SAMPLENAME | 2,000 | ||
5 | .2........ | 3 | SAMPLENO | SAMPLENAME | 1,000 | ||
6 | .2........ | 4 | SAMPLENO | SAMPLENAME | 1,000 | ||
7 | .2........ | 5 | SAMPLENO | SAMPLENAME | 1,000 | ||
8 | |||||||
9 | .2........ | 6 | SAMPLENO | SAMPLENAME | -1,000 | ||
10 | .2........ | 7 | SAMPLENO | SAMPLENAME | 2,000 | ||
Sheet1 |
I would greatly appreciate any help in regards to the problem above.
SY24