neilp
Well-known Member
- Joined
- Jul 5, 2004
- Messages
- 529
- Office Version
- 365
- Platform
- Windows
I posted this a few days ago, but I am terrible at explaining myself, so no-one was able to help
I thought i would give it another attempt, simplified and with examples, so sorry for the length of this.
I have a spreadsheet and a User Form (attached)
the userform is fairly simple - the textbox in line1 is textbox1, the textboxes in line2 are textbox2 and textbox3, etc, etc.
I need a macro that, when the process button it pressed, excel will search through the data in the spreadsheet looking at the "code" column.
If, as in this example, it find 3 lines that all have the same code (1243), then i would like it to populate column "count" with whatever is in the textboxes next to line 3 on the userform (the first textbox would go in the first in the first row that code appears, the second in the second row and the third textbox in the third row.
it would then do a similar thing if it found 2 lines with the same code (1358), but would use the textboxes from "line2" on the userform etc
so the following would be the output from the "Userform example"
has this helped anyone decifer my brain?
thanks for sticking with this to the bottom
Neil
I thought i would give it another attempt, simplified and with examples, so sorry for the length of this.
I have a spreadsheet and a User Form (attached)
Copy of shelf work.xls | |||||||
---|---|---|---|---|---|---|---|
A | B | C | D | E | |||
1 | Collection Date | Consignment Number | Barcode Number | Code | Count | ||
2 | 2020-11-02 17:00 | ZZ3020010610021313613 | 1780565246 | 1243 | |||
3 | 2020-11-02 17:00 | ZZ3020010610021313613 | 1780565247 | 1243 | |||
4 | 2020-11-02 17:00 | ZZ3020010610021313613 | 1780565248 | 1243 | |||
5 | 2020-11-02 17:00 | ZZ3020010610021313614 | 1780565256 | 1358 | |||
6 | 2020-11-02 17:00 | ZZ3020010610021313614 | 1780565257 | 1358 | |||
7 | 2020-11-02 17:00 | ZZ3020010610021313615 | 1780565267 | 1232 | |||
8 | 2020-11-02 17:00 | ZZ3020010610021313615 | 1780565268 | 1232 | |||
9 | 2020-11-02 17:00 | ZZ3020010610021313615 | 1780565269 | 1232 | |||
10 | 2020-11-02 17:00 | ZZ3020010610021313615 | 1780565270 | 1232 | |||
11 | 2020-11-02 17:00 | ZZ3020010610021313616 | 1780565275 | 1321 | |||
12 | 2020-11-02 17:00 | ZZ3020010610021313616 | 1780565276 | 1321 | |||
13 | 2020-11-02 17:00 | ZZ3020010610021313617 | 1780565286 | 1203 | |||
14 | 2020-11-02 17:00 | ZZ3020010610021313617 | 1780565287 | 1203 | |||
15 | 2020-11-02 17:00 | ZZ3020010610021313617 | 1780565288 | 1203 | |||
data |
the userform is fairly simple - the textbox in line1 is textbox1, the textboxes in line2 are textbox2 and textbox3, etc, etc.
I need a macro that, when the process button it pressed, excel will search through the data in the spreadsheet looking at the "code" column.
If, as in this example, it find 3 lines that all have the same code (1243), then i would like it to populate column "count" with whatever is in the textboxes next to line 3 on the userform (the first textbox would go in the first in the first row that code appears, the second in the second row and the third textbox in the third row.
it would then do a similar thing if it found 2 lines with the same code (1358), but would use the textboxes from "line2" on the userform etc
so the following would be the output from the "Userform example"
Copy of shelf work.xls | |||||||
---|---|---|---|---|---|---|---|
A | B | C | D | E | |||
1 | Collection Date | Consignment Number | Barcode Number | Code | Count | ||
2 | 2020-11-02 17:00 | ZZ3020010610021313613 | 1780565246 | 1243 | 3 | ||
3 | 2020-11-02 17:00 | ZZ3020010610021313613 | 1780565247 | 1243 | 1 | ||
4 | 2020-11-02 17:00 | ZZ3020010610021313613 | 1780565248 | 1243 | 2 | ||
5 | 2020-11-02 17:00 | ZZ3020010610021313614 | 1780565256 | 1358 | 7 | ||
6 | 2020-11-02 17:00 | ZZ3020010610021313614 | 1780565257 | 1358 | 5 | ||
7 | 2020-11-02 17:00 | ZZ3020010610021313615 | 1780565267 | 1232 | 3 | ||
8 | 2020-11-02 17:00 | ZZ3020010610021313615 | 1780565268 | 1232 | 3 | ||
9 | 2020-11-02 17:00 | ZZ3020010610021313615 | 1780565269 | 1232 | 1 | ||
10 | 2020-11-02 17:00 | ZZ3020010610021313615 | 1780565270 | 1232 | 6 | ||
11 | 2020-11-02 17:00 | ZZ3020010610021313616 | 1780565275 | 1321 | 7 | ||
12 | 2020-11-02 17:00 | ZZ3020010610021313616 | 1780565276 | 1321 | 5 | ||
13 | 2020-11-02 17:00 | ZZ3020010610021313617 | 1780565286 | 1203 | 3 | ||
14 | 2020-11-02 17:00 | ZZ3020010610021313617 | 1780565287 | 1203 | 1 | ||
15 | 2020-11-02 17:00 | ZZ3020010610021313617 | 1780565288 | 1203 | 2 | ||
data |
has this helped anyone decifer my brain?
thanks for sticking with this to the bottom
Neil