You don't actually need For Each loop in this event, because you are setting the same opacity to all instances, but there is nothing wrong with using For Each here.
Your code is correct, it should be working.
.
If you are interested, there is a much shorter way to do the same:
Mouse | Cursor is over [SPRITE-AAA]
--> [SPITE-BBB] Set opacity to ((varibale1 > variable2)*100)