Hello everyone,
Given my level in vba, impossible for me to find a solution, hence my request.
The purpose of the code is to modify the content of the cells in column "F" according to the content of the cells in column "A".
Let me explain:
To begin with and according to what I have just explained above, the two columns that we are going to work on are column "A" and column "F".
Information about the contents of the cells in column "A"
1- All cells in column "A" end either with "M" for Male or with "F" for Female.
2- All the cells of column "A" contain a year, this year (with four digits) is in the 3rd position starting from the right.
3- We are going to process only the cells of column "A" which contain the current year, therefore those of the year "2023".
What should the requested code do:
To. Determine the cells of column "A" to process, therefore with year "2023".
b. Determine the sex of the subject who is in column "A"
Two scenarios present themselves to us: either the cell ends with "M" or with "F"
If the cell ends with "M", then we will check the content of the cell in column "F" which is on the same line as the cell in column "A", if the content is different from "5H", we correct it, otherwise we go to the next cell.
If the cell ends with "F", then we will check the content of the cell in column "F" which is on the same line as the cell in column "A", if the content is different from "4B", we correct it, otherwise we go to the next cell.
I allow myself to ask you for a quick code because the lines to be processed are numerous.
I remain at your disposal for any additional information.
Thank you in advance for your suggestions.
Unless I am mistaken, you will find below the desired result:
Given my level in vba, impossible for me to find a solution, hence my request.
The purpose of the code is to modify the content of the cells in column "F" according to the content of the cells in column "A".
Let me explain:
To begin with and according to what I have just explained above, the two columns that we are going to work on are column "A" and column "F".
Information about the contents of the cells in column "A"
1- All cells in column "A" end either with "M" for Male or with "F" for Female.
2- All the cells of column "A" contain a year, this year (with four digits) is in the 3rd position starting from the right.
3- We are going to process only the cells of column "A" which contain the current year, therefore those of the year "2023".
What should the requested code do:
To. Determine the cells of column "A" to process, therefore with year "2023".
b. Determine the sex of the subject who is in column "A"
Two scenarios present themselves to us: either the cell ends with "M" or with "F"
If the cell ends with "M", then we will check the content of the cell in column "F" which is on the same line as the cell in column "A", if the content is different from "5H", we correct it, otherwise we go to the next cell.
If the cell ends with "F", then we will check the content of the cell in column "F" which is on the same line as the cell in column "A", if the content is different from "4B", we correct it, otherwise we go to the next cell.
I allow myself to ask you for a quick code because the lines to be processed are numerous.
I remain at your disposal for any additional information.
Thank you in advance for your suggestions.
Unless I am mistaken, you will find below the desired result:
Classeur1 | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | |||
1 | Jeune | Père | Mère | Eleveur | Age | Volière | Cage | Né(e) | Tours | Information | Elevage | ||
2 | AE27-093/2012 M | MA76-020/2011 M | MM72-112/2011 F | Gérard Claude | 10a 11m 28j | 2B | 16 | 8-06-2012 | 4T | ||||
3 | AE27-094/2012 M | MA76-020/2011 M | MM72-112/2011 F | Gérard Claude | 10a 11m 28j | 2B | 16 | 8-06-2012 | 4T | ||||
4 | AE27-100/2012 F | CF03-156/2011 M | MM72-114/2011 F | Gérard Claude | 10a 11m 26j | 2B | 13 | 10-06-2012 | 4T | ||||
5 | AE27-059/2013 F | CF03-156/2011 M | MM72-114/2011 F | Gérard Claude | 10a 1m 11j | 3H | 13 | 25-04-2013 | 4T | ||||
6 | AE27-060/2013 M | PG14-029/2012 M | PG14-050/2012 F | Gérard Claude | 10a 0m 31j | 5H | 19 | 5-05-2013 | 5T | ||||
7 | AE27-084R-10/2013 M | YM856-117/2009 M | YM856-083/2012 F | Gérard Claude | 10a 0m 18j | 3H | 1 | 18-05-2013 | 4T | ||||
8 | AE27-084/2013 M | AE27-086/2012 M | MN96-075/2012 F | Gérard Claude | 10a 0m 17j | 3H | 16 | 19-05-2013 | 4T | ||||
9 | AE27-085R-12/2013 M | YM856-101/2012 M | MN96-075/2012 F | Gérard Claude | 9a 11m 26j | 3H | 16 | 10-06-2013 | 4T | ||||
10 | AE27-085/2013 M | AE27-032/2012 M | PG15-131/2012 F | Gérard Claude | 10a 0m 18j | 5H | 21 | 18-05-2013 | 4T | ||||
11 | AE27-086/2013 F | AE27-032/2012 M | PG15-131/2012 F | Gérard Claude | 9a 11m 9j | 2B | 21 | 27-06-2013 | 4T | ||||
12 | AE27-087/2013 F | YM856-028/2010 M | PG14-041/2012 F | Gérard Claude | 10a 0m 18j | 5H | 22 | 18-05-2013 | 4T | ||||
13 | AE27-011/2019 F | PG14-003/2018 M | AE27-003/2018 F | Gérard Claude | 4a 1m 14j | 4H | 11 | 22-04-2019 | 5T | ||||
14 | AE27-012/2019 F | PG14-003/2018 M | AE27-003/2018 F | Gérard Claude | 4a 1m 14j | 5H | 11 | 22-04-2019 | 5T | ||||
15 | AE27-013/2019 M | PG14-048/2016 M | AE27-008/2018 F | Gérard Claude | 4a 1m 14j | 4H | 1 | 22-04-2019 | 4T | ||||
16 | AE27-014/2019 F | AE27-029/2017 M | PG14-048/2018 F | Gérard Claude | 4a 1m 16j | 4H | 2 | 20-04-2019 | 4T | ||||
17 | AE27-015/2019 M | AE27-032/2017 M | AE27-007/2018 F | Gérard Claude | 4a 1m 17j | 4H | 6 | 19-04-2019 | 4T | ||||
18 | AE27-017/2019 F | AE27-032/2017 M | AE27-007/2018 F | Gérard Claude | 4a 1m 17j | 3H | 6 | 19-04-2019 | 4T | ||||
19 | AE27-042/2022 M | MN96-046/2019 M | MN96-036/2021 F | Gérard Claude | 0a 11m 18j | 5H | 6 | 18-06-2022 | 4T | x | |||
20 | AE27-043/2022 F | MN96-046/2019 M | MN96-036/2021 F | Gérard Claude | 0a 11m 18j | 4H | 6 | 18-06-2022 | 4T | ||||
21 | AE27-045/2022 M | AE27-024/2021 M | AE27-016+/2020 F | Gérard Claude | 0a 11m 11j | 5H | 8 | 25-06-2022 | 4T | ||||
22 | AE27-046/2022 M | AE27-024/2021 M | AE27-016+/2020 F | Gérard Claude | 0a 11m 11j | 5H | 8 | 25-06-2022 | 4T | ||||
23 | AE27-047/2022 F | AE27-024/2021 M | AE27-016+/2020 F | Gérard Claude | 0a 11m 11j | 4H | 8 | 25-06-2022 | 4T | ||||
24 | AE27-048/2022 F | AE27-006/2021 M | AE27-052/2021 F | Gérard Claude | 0a 11m 8j | 4H | 3 | 28-06-2022 | 4T | ||||
25 | AE27-049/2022 F | AE27-006/2021 M | AE27-052/2021 F | Gérard Claude | 0a 11m 8j | 4H | 3 | 28-06-2022 | 4T | ||||
26 | HTY27-001/2023 M | AE27-008/2022 M | AE27-039/2022 F | Gérard Claude | 0a 1m 11j | 5H | 15 | 25-04-2023 | 4T | ||||
27 | HTY27-002/2023 M | AE27-035/2022 M | MN96-008/2022 F | Gérard Claude | 0a 1m 3j | 5H | 11 | 1-05-2023 | 4T | ||||
28 | HTY27-003/2023 M | AE27-032/2022 M | AE27-026/2022 F | Gérard Claude | 0a 0m 31j | 5H | 12 | 5-05-2023 | 4T | ||||
29 | HTY27-004/2023 M | AE27-010/2021 M | MN96-034/2021 F | Gérard Claude | 0a 0m 15j | 5H | 5 | 21-05-2023 | 4T | ||||
30 | HTY27-005/2023 M | AE27-010/2021 M | MN96-034/2021 F | Gérard Claude | 0a 0m 15j | 5H | 5 | 21-05-2023 | 4T | ||||
31 | HTY27-006/2023 M | AE27-010/2021 M | MN96-034/2021 F | Gérard Claude | 0a 0m 15j | 5H | 5 | 21-05-2023 | 4T | ||||
32 | HTY27-007/2023 M | AE27-010/2021 M | MN96-034/2021 F | Gérard Claude | 0a 0m 15j | 5H | 5 | 21-05-2023 | 4T | ||||
33 | HTY27-008/2023 M | AE27-010/2021 M | MN96-034/2021 F | Gérard Claude | 0a 0m 15j | 5H | 5 | 21-05-2023 | 4T | ||||
34 | HTY27-009/2023 F | AE27-022/2022 M | MN96-010/2020 F | Gérard Claude | 0a 0m 14j | 4B | 6 | 22-05-2023 | 4T | ||||
35 | HTY27-010/2023 F | AE27-022/2022 M | MN96-010/2020 F | Gérard Claude | 0a 0m 14j | 4B | 6 | 22-05-2023 | 4T | ||||
36 | HTY27-011/2023 F | AE27-022/2022 M | MN96-010/2020 F | Gérard Claude | 0a 0m 14j | 4B | 6 | 22-05-2023 | 4T | ||||
37 | HTY27-012/2023 M | AE27-029/2022 M | 207-034/2022 F | Gérard Claude | 0a 0m 13j | 5H | 13 | 23-05-2023 | 4T | ||||
38 | HTY27-013/2023 M | AE27-029/2022 M | 207-034/2022 F | Gérard Claude | 0a 0m 13j | 5H | 13 | 23-05-2023 | 4T | ||||
39 | HTY27-014/2023 F | AE27-029/2022 M | 207-034/2022 F | Gérard Claude | 0a 0m 13j | 4B | 13 | 23-05-2023 | 4T | ||||
40 | HTY27-015/2023 F | AE27-33/2022 M | AE27-024/2022 F | Gérard Claude | 0a 0m 11j | 4B | 7 | 25-05-2023 | 4T | ||||
41 | HTY27-016/2023 F | AE27-008/2022 M | AE27-039/2022 F | Gérard Claude | 0a 1m 11j | 4B | 15 | 25-04-2023 | 4T | ||||
42 | HTY27-017/2023 M | AE27-035/2022 M | MN96-008/2022 F | Gérard Claude | 0a 1m 3j | 5H | 11 | 1-05-2023 | 4T | ||||
43 | HTY27-018/2023 M | AE27-032/2022 M | AE27-026/2022 F | Gérard Claude | 0a 0m 31j | 5H | 12 | 5-05-2023 | 4T | ||||
44 | HTY27-019/2023 F | AE27-010/2021 M | MN96-034/2021 F | Gérard Claude | 0a 0m 15j | 4B | 5 | 21-05-2023 | 4T | ||||
45 | HTY27-020/2023 M | AE27-010/2021 M | MN96-034/2021 F | Gérard Claude | 0a 0m 15j | 5H | 5 | 21-05-2023 | 4T | ||||
46 | HTY27-021/2023 F | AE27-010/2021 M | MN96-034/2021 F | Gérard Claude | 0a 0m 15j | 4B | 5 | 21-05-2023 | 4T | ||||
47 | HTY27-022/2023 M | AE27-010/2021 M | MN96-034/2021 F | Gérard Claude | 0a 0m 15j | 5H | 5 | 21-05-2023 | 4T | ||||
48 | HTY27-023/2023 M | AE27-010/2021 M | MN96-034/2021 F | Gérard Claude | 0a 0m 15j | 5H | 5 | 21-05-2023 | 4T | ||||
49 | HTY27-024/2023 M | AE27-022/2022 M | MN96-010/2020 F | Gérard Claude | 0a 0m 14j | 5H | 6 | 22-05-2023 | 4T | ||||
50 | HTY27-025/2023 F | AE27-022/2022 M | MN96-010/2020 F | Gérard Claude | 0a 0m 14j | 4B | 6 | 22-05-2023 | 4T | ||||
51 | HTY27-026/2023 M | AE27-022/2022 M | MN96-010/2020 F | Gérard Claude | 0a 0m 14j | 5H | 6 | 22-05-2023 | 4T | ||||
52 | HTY27-027/2023 M | AE27-029/2022 M | 207-034/2022 F | Gérard Claude | 0a 0m 13j | 5H | 13 | 23-05-2023 | 4T | ||||
53 | HTY27-028/2023 M | AE27-029/2022 M | 207-034/2022 F | Gérard Claude | 0a 0m 13j | 5H | 13 | 23-05-2023 | 4T | ||||
54 | HTY27-029/2023 M | AE27-029/2022 M | 207-034/2022 F | Gérard Claude | 0a 0m 13j | 5H | 13 | 23-05-2023 | 4T | ||||
55 | HTY27-030/2023 M | AE27-33/2022 M | AE27-024/2022 F | Gérard Claude | 0a 0m 11j | 5H | 7 | 25-05-2023 | 4T | ||||
56 | HTY27-031/2023 M | AE27-008/2022 M | AE27-039/2022 F | Gérard Claude | 0a 1m 11j | 5H | 15 | 25-04-2023 | 4T | ||||
57 | HTY27-032/2023 M | AE27-035/2022 M | MN96-008/2022 F | Gérard Claude | 0a 1m 3j | 5H | 11 | 1-05-2023 | 4T | ||||
58 | AE27-095/2012 F | MA76-020/2011 M | MM72-112/2011 F | Gérard Claude | 10a 11m 28j | 4B | 16 | 8-06-2012 | 4T | ||||
59 | AE27-096/2012 F | CF03-156/2011 M | MM72-114/2011 F | Gérard Claude | 10a 11m 26j | 4B | 13 | 10-06-2012 | 4T | ||||
60 | AE27-097/2012 M | CF03-156/2011 M | MM72-114/2011 F | Gérard Claude | 10a 11m 26j | 5H | 13 | 10-06-2012 | 4T | ||||
61 | AE27-098/2012 M | CF03-156/2011 M | MM72-114/2011 F | Gérard Claude | 10a 11m 26j | 5H | 13 | 10-06-2012 | 4T | ||||
62 | AE27-099/2012 M | CF03-156/2011 M | MM72-114/2011 F | Gérard Claude | 10a 11m 26j | 5H | 13 | 10-06-2012 | 4T | ||||
63 | HTY27-038/2023 M | AE27-010/2021 M | MN96-034/2021 F | Gérard Claude | 0a 0m 15j | 5H | 5 | 21-05-2023 | 4T | ||||
64 | HTY27-039/2023 F | AE27-022/2022 M | MN96-010/2020 F | Gérard Claude | 0a 0m 14j | 4B | 6 | 22-05-2023 | 4T | ||||
65 | HTY27-040/2023 F | AE27-022/2022 M | MN96-010/2020 F | Gérard Claude | 0a 0m 14j | 4B | 6 | 22-05-2023 | 4T | ||||
66 | HTY27-041/2023 M | AE27-022/2022 M | MN96-010/2020 F | Gérard Claude | 0a 0m 14j | 5H | 6 | 22-05-2023 | 4T | ||||
67 | HTY27-042/2023 F | AE27-029/2022 M | 207-034/2022 F | Gérard Claude | 0a 0m 13j | 4B | 13 | 23-05-2023 | 4T | ||||
68 | HTY27-043/2023 M | AE27-029/2022 M | 207-034/2022 F | Gérard Claude | 0a 0m 13j | 5H | 13 | 23-05-2023 | 4T | ||||
69 | HTY27-044/2023 M | AE27-029/2022 M | 207-034/2022 F | Gérard Claude | 0a 0m 13j | 5H | 13 | 23-05-2023 | 4T | ||||
70 | HTY27-045/2023 F | AE27-33/2022 M | AE27-024/2022 F | Gérard Claude | 0a 0m 11j | 4B | 7 | 25-05-2023 | 4T | ||||
71 | HTY27-046/2023 F | AE27-008/2022 M | AE27-039/2022 F | Gérard Claude | 0a 1m 11j | 4B | 15 | 25-04-2023 | 4T | ||||
72 | HTY27-047/2023 M | AE27-035/2022 M | MN96-008/2022 F | Gérard Claude | 0a 1m 3j | 5H | 11 | 1-05-2023 | 4T | ||||
73 | HTY27-048/2023 F | PG14-003/2018 M | AE27-003/2018 F | Gérard Claude | 4a 1m 14j | 4B | 11 | 22-04-2019 | 5T | ||||
74 | HTY27-049/2023 M | PG14-003/2018 M | AE27-003/2018 F | Gérard Claude | 4a 1m 14j | 5H | 11 | 22-04-2019 | 5T | ||||
75 | HTY27-050/2023 M | PG14-003/2018 M | AE27-003/2018 F | Gérard Claude | 4a 1m 14j | 5H | 11 | 22-04-2019 | 5T | ||||
76 | HTY27-051/2023 F | PG14-003/2018 M | AE27-003/2018 F | Gérard Claude | 4a 1m 14j | 4B | 11 | 22-04-2019 | 5T | ||||
77 | HTY27-052/2023 F | PG14-048/2016 M | AE27-008/2018 F | Gérard Claude | 4a 1m 14j | 4B | 1 | 22-04-2019 | 4T | ||||
78 | HTY27-053/2023 F | AE27-029/2017 M | PG14-048/2018 F | Gérard Claude | 4a 1m 16j | 4B | 2 | 20-04-2019 | 4T | ||||
79 | HTY27-054/2023 F | AE27-010/2021 M | MN96-034/2021 F | Gérard Claude | 0a 0m 15j | 4B | 5 | 21-05-2023 | 4T | ||||
80 | HTY27-055/2023 M | AE27-010/2021 M | MN96-034/2021 F | Gérard Claude | 0a 0m 15j | 5H | 5 | 21-05-2023 | 4T | ||||
81 | HTY27-056/2023 M | AE27-010/2021 M | MN96-034/2021 F | Gérard Claude | 0a 0m 15j | 5H | 5 | 21-05-2023 | 4T | ||||
82 | HTY27-057/2023 M | AE27-010/2021 M | MN96-034/2021 F | Gérard Claude | 0a 0m 15j | 5H | 5 | 21-05-2023 | 4T | ||||
83 | HTY27-058/2023 M | AE27-035/2022 M | MN96-008/2022 F | Gérard Claude | 0a 1m 3j | 5H | 11 | 1-05-2023 | 4T | ||||
84 | HTY27-059/2023 F | AE27-032/2022 M | AE27-026/2022 F | Gérard Claude | 0a 0m 31j | 4B | 12 | 5-05-2023 | 4T | ||||
85 | HTY27-060/2023 M | AE27-010/2021 M | MN96-034/2021 F | Gérard Claude | 0a 0m 15j | 5H | 5 | 21-05-2023 | 4T | ||||
86 | HTY27-061/2023 F | AE27-010/2021 M | MN96-034/2021 F | Gérard Claude | 0a 0m 15j | 4B | 5 | 21-05-2023 | 4T | ||||
87 | HTY27-062/2023 M | AE27-010/2021 M | MN96-034/2021 F | Gérard Claude | 0a 0m 15j | 5H | 5 | 21-05-2023 | 4T | ||||
88 | HTY27-063/2023 F | AE27-010/2021 M | MN96-034/2021 F | Gérard Claude | 0a 0m 15j | 4B | 5 | 21-05-2023 | 4T | ||||
89 | HTY27-064/2023 M | AE27-010/2021 M | MN96-034/2021 F | Gérard Claude | 0a 0m 15j | 5H | 5 | 21-05-2023 | 4T | ||||
90 | HTY27-065/2023 F | AE27-022/2022 M | MN96-010/2020 F | Gérard Claude | 0a 0m 14j | 4B | 6 | 22-05-2023 | 4T | ||||
91 | HTY27-066/2023 F | AE27-029/2022 M | 207-034/2022 F | Gérard Claude | 0a 0m 13j | 4B | 13 | 23-05-2023 | 4T | ||||
92 | HTY27-067/2023 F | AE27-029/2022 M | 207-034/2022 F | Gérard Claude | 0a 0m 13j | 4B | 13 | 23-05-2023 | 4T | ||||
93 | HTY27-068/2023 M | AE27-029/2022 M | 207-034/2022 F | Gérard Claude | 0a 0m 13j | 5H | 13 | 23-05-2023 | 4T | ||||
94 | HTY27-069/2023 F | AE27-33/2022 M | AE27-024/2022 F | Gérard Claude | 0a 0m 11j | 4B | 7 | 25-05-2023 | 4T | ||||
Feuil1 |