Macro/Logical Editor to trim the head to the start of another

Asssue I selt the green and yellow notes, and I would like to always trim the head of the bottom one ( green here) to the yellow note. Is there any way to do this without trim tool? If not is it possible to do this in LE, any workarounds to do this say in Score editor.