The sort order will not affect the macro. It will run until the last cell in the C column only processing the rows where the D columns cell is blank.

Glad to hear that it is working.