If a line finishes with 'Then', it needs an 'End If' later on.
If a line has something after the 'Then', it executes that code if the
condition is True, the subsequent line is a normal line not reliant on
the If statement above it.
The code as it stands won't work very well since the active cell never
changes, but I suppose you didn't copy those lines either - because
they were further down the code.