I have an Excel worksheet with 20K rows like this:
| header1 | header2 |
|---|---|
| 1 | P |
| 2 | P |
| 3 | P |
| 4 | Q |
| 5 | R |
| 6 | R |
| 7 | R |
| 8 | R |
| 9 | S |
| 10 | S |
I want a VBA code to delete the rows containing duplicates, but keep the first and last row of the duplicates. The result should be like this:
| header1 | header2 |
|---|---|
| 1 | P |
| 3 | P |
| 4 | Q |
| 5 | R |
| 8 | R |
| 9 | S |
| 10 | S |

