Hello everyone,
Given my low level in vba, I allow myself to post my request for code that I cannot solve, presenting my thanks in advance to all those who from far or near can contribute to advancing my request.
The requested code should copy the lines selected by the user in the "Issues" sheet to paste them in the sheet of his choice. Which means that asking the user for the name of the sheet is necessary, the "Issues" sheet contains 11 columns and important and variable rows each month. I have reduced the number of lines for the purposes of this request.
Information: To save time when you want to select the rows to copy, we will only select a single cell for each row concerned but not the entire row.
The code put in place must take into account two scenarios:
First case: The name of the sheet mentioned by the user does not exist, so it must be created, taking care to put the same headers as the "Issues" sheet in the first line and only then copy the selected lines .
Second case: The sheet exists, then we have two possibilities:
The user is then asked if he wishes to keep the old existing data, if the answer is "yes", in this case, we go to the first empty line below the existing lines to copy the new data there.
If the user does not wish to keep the old data, in this case, we erase the existing data from the 2nd line to the last line and then only after we paste the new lines selected from the second line, since the first line already contains the same headers as the "Issues" sheet.
Important information: the selected rows are not always next to each other, sometimes they are and sometimes they are not.
I hope I was clear in my explanations to allow you to help me solve my problem, however, I remain at your disposal for other additional information.
Here is the content of the "Issues" sheet
Given my low level in vba, I allow myself to post my request for code that I cannot solve, presenting my thanks in advance to all those who from far or near can contribute to advancing my request.
The requested code should copy the lines selected by the user in the "Issues" sheet to paste them in the sheet of his choice. Which means that asking the user for the name of the sheet is necessary, the "Issues" sheet contains 11 columns and important and variable rows each month. I have reduced the number of lines for the purposes of this request.
Information: To save time when you want to select the rows to copy, we will only select a single cell for each row concerned but not the entire row.
The code put in place must take into account two scenarios:
First case: The name of the sheet mentioned by the user does not exist, so it must be created, taking care to put the same headers as the "Issues" sheet in the first line and only then copy the selected lines .
Second case: The sheet exists, then we have two possibilities:
The user is then asked if he wishes to keep the old existing data, if the answer is "yes", in this case, we go to the first empty line below the existing lines to copy the new data there.
If the user does not wish to keep the old data, in this case, we erase the existing data from the 2nd line to the last line and then only after we paste the new lines selected from the second line, since the first line already contains the same headers as the "Issues" sheet.
Important information: the selected rows are not always next to each other, sometimes they are and sometimes they are not.
I hope I was clear in my explanations to allow you to help me solve my problem, however, I remain at your disposal for other additional information.
Here is the content of the "Issues" sheet
Classeur1.xlsm | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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 | 856-022/2011 M | 0811-021/2008 M | 435-007/2009 F | AE --> CF | 10a 0m 0j | 1B | 7 | 38093 | 4T | Femelle | x | ||
3 | 876-025/2006 F | 0811-021/2008 M | 435-007/2009 F | AE --> CF | 10a 0m 0j | 1B | 7 | 38822 | 4T | Femelle | x | ||
4 | |||||||||||||
5 | 876-054/2004 F | 0811-021/2008 M | 856-047/2002 F | AE --> CF | 10a 10m 10j | 1B | 8 | 38822 | 4T | Femelle | x | ||
6 | |||||||||||||
7 | AE-003/2011 M | 235-096/2005 M | 856-078/2010 F | AE --> CF | 10a 10m 10j | 1H | 8 | 39187 | 4T | Femelle | x | ||
8 | |||||||||||||
9 | AE-014/2011 M | 25-004/2009 M | 856-117/2009 F | AE --> CF | 10a 10m 10j | 1H | 8 | 39187 | 4T | Femelle | x | ||
10 | |||||||||||||
11 | AE-015/2011 F | 838-010/2008 M | 856-146/2009 F | AE --> CF | 10a 10m 15j | 1H | 10 | 40257 | 4T | Femelle | x | ||
12 | AE-035/2013 F | 838-010/2008 M | 856-146/2009 F | AT | 10a 10m 15j | 1H | 12 | 40283 | 4T | Femelle | x | ||
13 | AE-035R/2012 F | 838-010/2008 M | 856-146/2009 F | AT | 10a 10m 15j | 1H | 12 | 40283 | 4T | Femelle | x | ||
14 | AE-036/2013 M | 838-010/2008 M | 856-146/2009 F | AT | 10a 10m 15j | 1H | 12 | 40283 | 4T | Femelle | x | ||
15 | |||||||||||||
16 | AE-037/2013 M | 856-004/2010 M | 856-146/2009 F | AT | 10a 10m 18j | 2B | 12 | 40283 | 4T | Femelle | x | ||
17 | |||||||||||||
18 | AE-039/2012 M | 856-061/2002 M | 856-186/2007 F | AT | 10a 10m 18j | 2B | 12 | 40283 | 4T | Femelle | x | ||
19 | |||||||||||||
20 | AE-040/2012 F | 856-093/2010 M | 876-027/2005 F | AT | 10a 11m 24j | 2B | 12 | 40283 | 4T | Femelle | x | ||
21 | |||||||||||||
22 | AE-041/2012 F | 856-093/2010 M | 876-053/2009 F | DB | 10a 11m 24j | 2B | 12 | 40283 | 4T | Femelle | x | ||
23 | |||||||||||||
24 | AE-042/2012 F | 856-111/2010 M | 876-053/2009 F | DB | 10a 11m 24j | 2B | 12 | 40283 | 4T | Femelle | x | ||
25 | AE-042R-12/2013 F | 856-111/2010 M | 876-053/2009 F | DB | 10a 11m 24j | 2B | 12 | 40283 | 4T | Femelle | x | ||
26 | |||||||||||||
27 | AE-046/2012 M | 856-111/2010 M | AE-044/2011 F | EA | 10a 11m 24j | 2B | 12 | 40283 | 4T | Femelle | x | ||
28 | |||||||||||||
29 | AE-047/2012 F | 856-111/2010 M | AE-056/2012 F | EA | 10a 11m 24j | 2B | 12 | 40284 | 4T | Femelle | x | ||
30 | AE-048/2012 F | 856-111/2010 M | AE-056/2012 F | EA | 11a 0m 1j | 2B | 12 | 40284 | 4T | Femelle | x | ||
31 | AE-049/2012 M | 856-111/2010 M | AE-056/2012 F | EA | 11a 0m 1j | 2B | 17 | 40284 | 4T | Femelle | x | ||
32 | AE-050/2012 M | 856-111/2010 M | AE-056/2012 F | EA | 11a 0m 1j | 2H | 17 | 40633 | 4T | Femelle | x | ||
33 | AE-051/2012 M | 856-111/2010 M | AE-056/2012 F | EA | 11a 0m 29j | 3H | 17 | 40637 | 4T | Femelle | x | ||
34 | AE-052/2012 M | 856-111/2010 M | AE-056/2012 F | EA | 11a 0m 2j | 3H | 17 | 40648 | 4T | Femelle | x | ||
35 | |||||||||||||
36 | AE-053/2012 F | 856-115/2009 M | AE-060/2010 F | EA | 11a 0m 2j | 3H | 17 | 40648 | 4T | Femelle | x | ||
37 | |||||||||||||
38 | AE-067/2012 M | 856-117/2009 M | AE-062/2010 F | EA | 11a 0m 2j | 4B | 17 | 40648 | 4T | Femelle | x | ||
39 | |||||||||||||
40 | AE-083R-12/2013 F | 856-117/2009 M | AE-133/2010 F | EA | 11a 0m 2j | 4B | 17 | 40648 | 4T | Femelle | x | ||
41 | |||||||||||||
42 | AE-091/2011 M | 856-117/2009 M | AE-140/2011 F | EA | 11a 0m 2j | 4B | 17 | 40648 | 4T | Femelle | x | ||
43 | AE-092/2011 M | 856-117/2009 M | AE-140/2011 F | EA | 12a 0m 11j | 4B | 17 | 40648 | 4T | Femelle | x | ||
44 | AT-064/2010 M | 856-117/2009 M | AE-140/2011 F | EA | 12a 0m 17j | 4B | 17 | 40648 | 4T | Femelle | x | ||
45 | AT-066/2010 F | 856-117/2009 M | AE-140/2011 F | EA | 12a 0m 17j | 4B | 30 | 40648 | 4T | Femelle | x | ||
46 | |||||||||||||
47 | AT-067/2010 F | 876-037/2009 M | AE-140/2011 F | EA | 12a 0m 18j | 4B | 30 | 40648 | 4T | Femelle | x | ||
48 | AT-126/2012 M | 876-037/2009 M | AE-140/2011 F | EA | 12a 0m 18j | 4B | 30 | 40648 | 4T | Femelle | x | ||
49 | |||||||||||||
50 | AT-128/2011 F | 876-037/2009 M | AT-123/2011 F | EA | 12a 0m 18j | 4B | 30 | 40649 | 4T | Femelle | x | ||
51 | |||||||||||||
52 | AT-150/2012 F | 876-049/2009 M | AT-136/2011 F | EA | 12a 0m 18j | 4B | 30 | 40649 | 4T | Femelle | x | ||
53 | CF*-131/2012 M | 876-049/2009 M | AT-136/2011 F | EA | 12a 0m 18j | 4B | 30 | 40655 | 4T | Femelle | x | ||
54 | |||||||||||||
55 | CF*-132/2012 M | 876-050/2009 M | AT-136/2011 F | EA | 12a 0m 18j | 4B | 30 | 41003 | 4T | Femelle | |||
56 | |||||||||||||
57 | CF*-133/2012 F | AC10-008/2010 M | AT-136/2011 F | EA | 12a 0m 18j | 4B | 30 | 41030 | 5T | Femelle | |||
58 | |||||||||||||
59 | CF*-134/2012 F | AE-014/2011 M | MM-034/2011 F | EA | 12a 0m 18j | 4B | 30 | 41030 | 5T | Femelle | |||
60 | CF*-135/2012 M | AE-014/2011 M | MM-034/2011 F | EA | 12a 0m 18j | 4B | 30 | 41030 | 5T | Mâle | |||
61 | CF*-136/2012 F | AE-014/2011 M | MM-034/2011 F | EA | 12a 0m 18j | 4B | 30 | 41030 | 5T | Mâle | |||
62 | HCH57-018/2010 F | AE-014/2011 M | MM-034/2011 F | MM | 12a 0m 29j | 4B | 30 | 41030 | 5T | Mâle | |||
63 | |||||||||||||
64 | HCH57-019/2010 F | HCH55-027/2011 M | MM-034/2011 F | MM | 12a 1m 3j | 4B | 30 | 41031 | 5T | Mâle | |||
65 | |||||||||||||
66 | MM-009/2011 F | MA-009/2009 M | MM-034/2011 F | MM | 13a 0m 17j | 4B | 30 | 41031 | 5T | Mâle | |||
67 | MM-013/2011 M | MA-009/2009 M | MM-034/2011 F | MM | 13a 0m 17j | 4B | 30 | 41031 | 5T | Mâle | |||
68 | |||||||||||||
69 | MM-020/2011 M | MA-017/2008 M | MM-034/2011 F | MM | 13a 0m 17j | 4B | 30 | 41038 | 5T | Mâle | |||
70 | MM-047/2010 F | MA-017/2008 M | MM-034/2011 F | MM | 13a 0m 18j | 4H | 30 | 41038 | 5T | Mâle | |||
71 | |||||||||||||
72 | MM-048/2010 M | MM-020/2011 M | MM-034/2011 F | MM | 13a 0m 18j | 4H | 30 | 41038 | 5T | Mâle | |||
73 | |||||||||||||
74 | PG-004/2011 M | MM-020/2011 M | MM-047/2010 F | MY | 13a 0m 18j | 4H | 30 | 41038 | 5T | Mâle | |||
75 | |||||||||||||
76 | PG-009/2011 M | MM-020/2011 M | PG-005/2004 F | PG | 13a 0m 18j | 4H | 30 | 41038 | 5T | Mâle | |||
77 | |||||||||||||
78 | PG-024/2011 M | MM-020/2011 M | PG-012/2008 F | PG | 13a 0m 18j | 4H | 30 | 41038 | 5T | Mâle | |||
79 | PG-025/2011 F | MM-020/2011 M | PG-012/2008 F | PG | 13a 0m 18j | 5B | 30 | 41075 | 5T | Mâle | |||
80 | PG-026/2011 F | MM-020/2011 M | PG-012/2008 F | PG | 13a 0m 18j | 5B | 30 | 41075 | 5T | Mâle | |||
81 | PG-028/2006 F | MM-020/2011 M | PG-012/2008 F | PG | 13a 0m 18j | 5H | 30 | 41078 | 5T | Mâle | |||
82 | PG-038/2012 F | MM-020/2011 M | PG-012/2008 F | PG | 13a 0m 18j | 5H | 30 | 41078 | 5T | Mâle | |||
83 | PG-039/2010 M | MM-020/2011 M | PG-012/2008 F | PG | 13a 0m 18j | 5H | 30 | 41078 | 5T | Mâle | |||
84 | |||||||||||||
85 | PG-041/2010 F | MM-020/2011 M | PG-017/2009 F | PG | 13a 1m 13j | 5H | 30 | 41078 | 5T | Mâle | |||
86 | |||||||||||||
87 | PG-041/2012 F | PG-009/2011 M | PG-017/2009 F | PG | 16a 0m 18j | 5H | 30 | 41083 | 5T | Mâle | |||
88 | PG-042/2012 M | PG-009/2011 M | PG-017/2009 F | PG | 16a 0m 18j | 5H | 30 | 41083 | 5T | Mâle | |||
89 | |||||||||||||
90 | PG-044/2010 F | PG-024/2011 M | PG-019/2006 F | PG | 17a 0m 18j | 5H | 30 | 41083 | 5T | Mâle | |||
91 | |||||||||||||
92 | PG-045/2010 F | PG-039/2010 M | PG-019/2006 F | PG | 17a 0m 18j | 5H | 30 | 41397 | 5T | Mâle | |||
93 | |||||||||||||
94 | PG-051/2010 F | PG-039/2010 M | PG-024/2009 F | PG | 19a 0m 17j | 5H | 30 | 41397 | 5T | Mâle | |||
95 | PG-066/2010 F | PG-039/2010 M | PG-024/2009 F | PG | 9a 10m 19j | 5H | 30 | 41398 | 5T | Mâle | |||
96 | |||||||||||||
97 | PG-067/2007 F | PG-068/2006 M | PG-076/2009 F | PG | 9a 10m 23j | 5H | 30 | 41412 | 5T | Mâle | |||
98 | PG-068/2007 F | PG-068/2006 M | PG-076/2009 F | PG | 9a 11m 15j | 5H | 30 | 41435 | 5T | Mâle | |||
99 | |||||||||||||
100 | SC57-018/2010 F | PG-075/2010 M | PG-076/2009 F | PG | 9a 11m 29j | 5H | 30 | 41439 | 5T | Mâle | |||
Issus |
Last edited: