@KamilLanda has hard-coded the task. Very bad, because it is “hard-coded”. Let’s thank him for the fact that he still wanted to do it.
@Bort, we can all do it, as he did, but I would not do it, because we are not only answering questions, but also engaged in self-development, and we want to move forward on the right path, not sideways, not backwards. And we don’t want to increase the level of entropy in the universe.
I reasonably assumed that if the row numbers are known, and the associative values are also known (in this case, the names of countries), then let machines work with the numbers, and it is easier for people to work with meaningful information.
Procedural, hard-coded solutions are absolutely inflexible, difficult to maintain, and so on. This should be avoided if possible. I would like it to be less. After all, we work in LibreOffice Calc, and a lot has already been done before and for us.
@Bort, we don’t need “pants inside out” (as you once put it). Just don’t scold me here, please.
Alas, I still “insist” (I’m joking, of course) on changing the filtering criteria from row numbers to meaningful values. We are people. And, without seeing a specific example, it is difficult for me to say what needs to be changed in your example. Obviously, I shouldn’t have said that…
On the other hand, my example is focused on the work of the user, not the program. Maybe I guessed wrong. Should I have to guess? But someone makes changes: Private Sub Worksheet_Change
Please formulate the task in such a way that it is also interesting to us (and not “exactly” and in no other way).
@karolus, thank you for appreciating the example.