Delete all rows including cells in column "A" that are identical to the values in cells "D1", "E1","F1" and "A6".

harzer

Board Regular
Joined
Dec 15, 2021
Messages
153
Office Version
  1. 2016
Platform
  1. Windows
Hello everyone,
My VBA skills do not allow me to solve my problem, hence my request to the experts among you.
The headers of my table are as indicated in the first line (see image). All the cells in this first line keep the same values except cell "E1" which changes according to the user's needs, this cell always contains a number which varies from 1 to 20 maximum.
To solve my problem, we will work mainly on column "A", let me explain.
The second cell (non-empty) of column "A" is cell "A10", for information, the line number of this 2nd cell is variable, hence the need to determine the line number and the value from its cell each time Macro is launched to place them in variables that we will use in the macro.
Next, we will determine the row of the 3rd (non-empty) cell of column "A", (in our case, it is row 24), the row number of this 3rd non-empty cell is variable, d 'where the need to determine its number each time the Macro is launched.
Next, we will determine the last cell of column "A", the number of the last line is variable, hence the need to determine the number of the last line each time the Macro is launched.
The goal of the code is to delete all lines (entire) that start at the line of the 3rd non-empty cell (In our case here, it is from line 24), and that end at the last line of the column "A", (in our present case, it is line no. 45), when the cells of column "A" are identical to the cells found in cells "D1", "E1","F1 " and "A6"
As my data is important and in order to allow the macro to be very fast, I would like to ask you to use tables with: For i = LBound(DelValues) To UBound(DelValues).
In summary, the cells to allow the tests to be carried out are colored yellow, the lines which must be deleted are colored green.
I remain at your disposal for further information.
Thank you for your contributions.

Classeur1.xlsx
ABCDEF
1ConsanguinitéNbre de générations20Max 20 Générations
2
3976-054/2017 M
4392-019/2018 M
5392-043/2017 F
63024-066/2020 M
72203-008/2015 M
82207-067/2017 F
92207-029-2014 F
103024-060/2023 M
112207-079/2015 M
122207-089/2018 M
132207-021/2017 F
142207-032/2020 F
152207-058/2017 M
162207-006/2019 F
172207-029/2014 F
18
19
20
21
22
23
24Max 20 Générations3
253024-060/2023 M2
26Max 20 Générations2
273024-060/2023 M1
28392-019/2018 M1
29392-043/2017 F1
30Nbre de générations1
312203-008/2015 M1
322207-067/2017 F1
333024-060/2023 M1
34Nbre de générations1
352207-089/2018 M1
363024-060/2023 M1
37Nbre de générations1
382207-058/2017 M1
39201
40Nbre de générations1
41201
42Max 20 Générations1
43201
44Nbre de générations1
45Max 20 Générations1
Pedigree
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

Forum statistics

Threads
1,223,888
Messages
6,175,212
Members
452,618
Latest member
Tam84

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top