Assuming what you have works, you already have an autofill for column "D" that fills to row 8000.
I guess your question is what to replace the 8000 with for autfilling in column "E"
That's what this part of my suggestion calculates, it's 1 row before the first row holding the lower data in column "E".
Code:
Cells(2, "E").End(xlDown).Row - 1
So, where you have the macro putting the formula into E2, and then selecting E2,
add the following line after those ones and see if it works.
Code:
Selection.AutoFill Destination:=Range("E2:E" & Cells(2, "E").End(xlDown).Row - 1)