Thanks for your prompt reply as always. After applying your example, I found out that a lot of my first rows were also empty (see example). I would like to give City1, Town1 the max Code possible with the same City, in this case that would be 2000.
Let me ask you this... do you want to apply the max code or previous code? Those two are different things and I want to make sure that I give you a code which works for the issue you are trying to address