Hello everyone,
The code that I put at your disposal copies all the lines including the cells in column "K" which are equal to "X" or "x".
Here is the current code :
How can we modify it so that we can also copy the rows including the cells in column "K" which end in either "X" or "x".
Thank you for your contributions.
Here is a small part of my "Parents" sheet
Unless I'm mistaken, here is the result to display in the "Elevage" sheet :
The code that I put at your disposal copies all the lines including the cells in column "K" which are equal to "X" or "x".
Here is the current code :
VBA Code:
Sub Copier_Oiseaux_Elevage()
Dim rLastRow As Long, i As Long, j As Long, m As Long
Dim arr, brr
Dim sourceSht As String, targetSht As String
sourceSht = "Parents"
targetSht = "Elevage"
Application.ScreenUpdating = False
With Worksheets(sourceSht)
rLastRow = .Cells(.Rows.Count, "K").End(xlUp).Row
arr = .Range("A2:k" & rLastRow)
ReDim brr(1 To UBound(arr), 1 To 11)
m = 0
For i = 1 To UBound(arr)
If arr(i, 11) = "X" Or arr(i, 11) = "x" Then
m = m + 1
For j = 1 To 11
brr(m, j) = arr(i, j)
Next
End If
Next
End With
With Worksheets(targetSht)
.UsedRange.Offset(1, 0).Clear
.Range("a2").Resize(UBound(brr), UBound(brr, 2)) = brr
End With
Application.ScreenUpdating = True
End Sub
How can we modify it so that we can also copy the rows including the cells in column "K" which end in either "X" or "x".
Thank you for your contributions.
Here is a small part of my "Parents" sheet
Elevage.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 | Couleur | Elevage | ||
2 | Ae27-054/2023 M | Ae27-010/2021 M | Mn96-034/2021 F | Lamback Léon | 0a 11m 3j | 5H | 5 | 02-07-2023 | 4T | Mâle | |||
3 | Ae27-055/2023 F | Mn96-046/2019 M | Mn96-010/2021 F | Lamback Léon | 0a 10m 25j | 4B | 9 | 12-07-2023 | 4T | Femelle | x | ||
4 | Ae27-056/2023 F | Mn96-046/2019 M | Mn96-010/2021 F | Lamback Léon | 0a 10m 25j | 4B | 9 | 12-07-2023 | 4T | Femelle | |||
5 | Ae27-057/2023 F | Mn96-046/2019 M | Mn96-010/2021 F | Lamback Léon | 0a 10m 25j | 4B | 9 | 12-07-2023 | 4T | Femelle | |||
6 | Ae27-058/2023 F | Mn96-046/2019 M | Mn96-010/2021 F | Lamback Léon | 0a 10m 25j | 4B | 9 | 12-07-2023 | 4T | Femelle | |||
7 | 2024-059/2023 M | Mn96-046/2019 M | Mn96-010/2021 F | Lamback Léon | 0a 10m 25j | 5H | 9 | 12-07-2023 | 4T | Mâle | |||
8 | 30247-060/2023 M | 3024-066/2020 M | 2207-032/2020 F | Lamback Léon | 1a 0m 13j | 5B | 30 | 24-05-2023 | 4T | Mâle | X | ||
9 | Ae27-060/2023 F | Ae27-010/2021 M | Ae27-038/2022 F | Lamback Léon | 0a 10m 20j | 4B | 3 | 17-07-2023 | 4T | Femelle | |||
10 | Ae27-061/2023 F | Ae27-010/2021 M | Ae27-038/2022 F | Lamback Léon | 0a 10m 20j | 4B | 3 | 17-07-2023 | 4T | Femelle | |||
11 | Ae27-062/2023 F | Ae27-010/2021 M | Ae27-038/2022 F | Lamback Léon | 0a 10m 20j | 4B | 3 | 17-07-2023 | 4T | Femelle | |||
12 | Ae27-063/2023 F | Ae27-010/2021 M | Ae27-038/2022 F | Lamback Léon | 0a 10m 20j | 4B | 3 | 17-07-2023 | 4T | Femelle | X | ||
13 | Ae27-064/2023 F | Ae27-010/2021 M | Ae27-038/2022 F | Lamback Léon | 0a 10m 20j | 4B | 3 | 17-07-2023 | 4T | Femelle | |||
14 | Ae27-065/2023 F | Ae27-021/2022 M | Ae27-020/2022 F | Lamback Léon | 0a 10m 20j | 4B | 8 | 17-07-2023 | 4T | Femelle | x | ||
15 | Ae27-066/2023 M | Ae27-018/2022 M | Mn96-045/2022 F | Lamback Léon | 0a 10m 23j | 5H | 10 | 14-07-2023 | 4T | Mâle | |||
16 | Ae27-067/2023 M | Ae27-018/2022 M | Mn96-045/2022 F | Lamback Léon | 0a 10m 23j | 5H | 10 | 14-07-2023 | 4T | Mâle | |||
17 | Ae27-068/2023 F | Ae27-018/2022 M | Mn96-045/2022 F | Lamback Léon | 0a 10m 23j | 4B | 10 | 14-07-2023 | 4T | Femelle | |||
18 | Ae27-069/2023 M | Ae27-018/2022 M | Mn96-045/2022 F | Lamback Léon | 0a 10m 23j | 5H | 10 | 14-07-2023 | 4T | Mâle | X | ||
19 | Ae27-070/2023 M | Ae27-022/2022 M | Ae27-031/2022 F | Lamback Léon | 0a 10m 20j | 5H | 6 | 17-07-2023 | 4T | Mâle | |||
20 | Ae27-071/2023 F | Ae27-022/2022 M | Ae27-031/2022 F | Lamback Léon | 0a 10m 20j | 4B | 6 | 17-07-2023 | 4T | Femelle | |||
21 | Ae27-072/2023 M | Ae27-033/2022 M | Mn96-008/2022 F | Lamback Léon | 0a 10m 19j | 5H | 11 | 18-07-2023 | 4T | Mâle | |||
22 | Ae27-073/2023 M | Ae27-033/2022 M | Mn96-008/2022 F | Lamback Léon | 0a 10m 19j | 5H | 11 | 18-07-2023 | 4T | Mâle | |||
23 | Ae27-074/2023 F | Ae27-033/2022 M | Mn96-008/2022 F | Lamback Léon | 0a 10m 19j | 4B | 11 | 18-07-2023 | 4T | Femelle | |||
24 | Ae27-001/2024 F | Ae27-010/2021 M | Ae27-017/2023 F | Lamback Léon | 0a 1m 13j | 5H | 12 | 24-04-2024 | 4T | Femelle Tte jaune | Elevé / Ae27-017/23 x | ||
25 | Ae27-002/2024 M | Ae27-010/2021 M | Ae27-017/2023 F | Lamback Léon | 0a 1m 13j | 5H | 12 | 24-04-2024 | 4T | Mâle Tt jaune | Elevé / Ae27-017/23 | ||
26 | Ae27-003/2024 F | Ae27-036/2023 M | Mn96-045/2022 F | Lamback Léon | 0a 1m 9j | 5H | 13 | 28-04-2024 | 4T | Femelle Tte jaune | Elevé / Ae27-017/23X | ||
27 | Ae27-004/2024 F | Ae27-036/2023 M | Mn96-045/2022 F | Lamback Léon | 0a 1m 9j | 5H | 13 | 28-04-2024 | 4T | Femelle Tâche aile droite | Elevé / Ae27-017/23 | ||
28 | Ae27-005/2024 M | Ae27-022/2023 M | Ae27-015/2023 F | Lamback Léon | 0a 1m 4j | 5H | 11 | 01-05-2024 | 4T | Mâle Tte jaune | Elevé / Ae27-023/23 X | ||
29 | Ae27-006/2024 M | Ae27-022/2023 M | Ae27-015/2023 F | Lamback Léon | 0a 1m 4j | 5H | 11 | 01-05-2024 | 4T | Mâle Tâche derrière œil gauche | Elevé / Ae27-023/23 | ||
30 | Ae27-007/2024 M | 5919-001/2023 M | Ae27-023/2023 F | Lamback Léon | 0a 1m 4j | 5H | 8 | 01-05-2024 | 4T | Mâle Tt jaune | Elevé / Ae27-023/23 X | ||
31 | Ae27-008/2024 M | Ae27-033/2022 M | Ae27-009/2023 F | Lamback Léon | 0a 1m 4j | 5H | 4 | 01-05-2024 | 4T | Mâle Tâche au dos | Elevé / Ae27-023/23 | ||
32 | Ae27-009/2024 M | Ae27-033/2022 M | Ae27-009/2023 F | Lamback Léon | 0a 1m 4j | 5H | 4 | 01-05-2024 | 4T | Mâle Tâche au dos | Elevé / Mn96-045/22x | ||
33 | Ae27-010/2024 M | Ae27-033/2022 M | Ae27-009/2023 F | Lamback Léon | 0a 1m 4j | 5H | 4 | 01-05-2024 | 4T | Mâle Tâche ronde à la tête | Elevé / Mn96-045/22 | ||
34 | Ae27-011/2024 M | Ae27-035/2022 M | Ae27-055/2023 F | Lamback Léon | 0a 1m 2j | 5H | 16 | 03-05-2024 | 4T | Mâle | |||
35 | Ae27-012/2024 M | Ae27-035/2022 M | Ae27-055/2023 F | Lamback Léon | 0a 1m 2j | 5H | 16 | 03-05-2024 | 4T | Mâle | |||
36 | Ae27-013/2024 M | Ae27-035/2022 M | Ae27-055/2023 F | Lamback Léon | 0a 1m 2j | 5H | 16 | 03-05-2024 | 4T | Mâle | |||
37 | Ae27-014/2024 M | Ae27-035/2022 M | Ae27-055/2023 F | Lamback Léon | 0a 1m 2j | 5H | 16 | 03-05-2024 | 4T | Mâle | |||
38 | Ae27-015/2024 M | Ae27-035/2022 M | Ae27-055/2023 F | Lamback Léon | 0a 1m 2j | 5H | 16 | 03-05-2024 | 4T | Mâle | |||
39 | Ae27-016/2024 M | Mn96-020/2023 M | Ae27-038/2022 F | Lamback Léon | 0a 0m 31j | 5H | 10 | 06-05-2024 | 4T | Mâle | |||
40 | Ae27-017/2024 M | Mn96-020/2023 M | Ae27-038/2022 F | Lamback Léon | 0a 0m 31j | 5H | 10 | 06-05-2024 | 4T | Mâle | |||
41 | Ae27-018/2024 M | Ae27-069/2023 M | Mn96-034/2021 F | Lamback Léon | 0a 0m 31j | 5H | 2 | 06-05-2024 | 4T | Mâle | Elevé / Ae27-026/22 | ||
42 | Ae27-019/2024 M | Ae27-022/2022 M | Mn96-010/2021 F | Lamback Léon | 0a 0m 30j | 5H | 9 | 07-05-2024 | 4T | Mâle | |||
43 | Ae27-020/2024 M | Ae27-022/2022 M | Mn96-010/2021 F | Lamback Léon | 0a 0m 30j | 5H | 9 | 07-05-2024 | 4T | Mâle | |||
44 | Ae27-021/2024 M | Ae27-022/2022 M | Mn96-010/2021 F | Lamback Léon | 0a 0m 30j | 5H | 9 | 07-05-2024 | 4T | Mâle | x | ||
Parents |
Unless I'm mistaken, here is the result to display in the "Elevage" sheet :
Elevage.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 | Couleur | Elevage | ||
2 | Ae27-055/2023 F | Mn96-046/2019 M | Mn96-010/2021 F | Lamback Léon | 0a 10m 25j | 4B | 9 | 12-07-23 | 4T | Femelle | x | ||
3 | 30247-060/2023 M | 3024-066/2020 M | 2207-032/2020 F | Lamback Léon | 1a 0m 13j | 5B | 30 | 24-05-23 | 4T | Mâle | X | ||
4 | Ae27-063/2023 F | Ae27-010/2021 M | Ae27-038/2022 F | Lamback Léon | 0a 10m 20j | 4B | 3 | 17-07-23 | 4T | Femelle | X | ||
5 | Ae27-065/2023 F | Ae27-021/2022 M | Ae27-020/2022 F | Lamback Léon | 0a 10m 20j | 4B | 8 | 17-07-23 | 4T | Femelle | x | ||
6 | Ae27-069/2023 M | Ae27-018/2022 M | Mn96-045/2022 F | Lamback Léon | 0a 10m 23j | 5H | 10 | 14-07-23 | 4T | Mâle | X | ||
7 | Ae27-001/2024 F | Ae27-010/2021 M | Ae27-017/2023 F | Lamback Léon | 0a 1m 13j | 5H | 12 | 24-04-24 | 4T | Femelle Tte jaune | Elevé / Ae27-017/23 x | ||
8 | Ae27-003/2024 F | Ae27-036/2023 M | Mn96-045/2022 F | Lamback Léon | 0a 1m 9j | 5H | 13 | 45410 | 4T | Femelle Tte jaune | Elevé / Ae27-017/23X | ||
9 | Ae27-005/2024 M | Ae27-022/2023 M | Ae27-015/2023 F | Lamback Léon | 0a 1m 4j | 5H | 11 | 45413 | 4T | Mâle Tte jaune | Elevé / Ae27-023/23 X | ||
10 | Ae27-007/2024 M | 5919-001/2023 M | Ae27-023/2023 F | Lamback Léon | 0a 1m 4j | 5H | 8 | 45413 | 4T | Mâle Tt jaune | Elevé / Ae27-023/23 X | ||
11 | Ae27-009/2024 M | Ae27-033/2022 M | Ae27-009/2023 F | Lamback Léon | 0a 1m 4j | 5H | 4 | 45413 | 4T | Mâle Tâche au dos | Elevé / Mn96-045/22x | ||
12 | Ae27-021/2024 M | Ae27-022/2022 M | Mn96-010/2021 F | Lamback Léon | 0a 0m 30j | 5H | 9 | 45419 | 4T | Mâle | x | ||
Elevage |