How to prevent self-targeting

Is there a way to make a macro not target self? I have macros that target party members directly, but if they are out of range it will cast the spell on myself. Is there a way to stop that without having to turn off auto-self cast and have to make a bunch of self-targeting macros for when I am targeting an enemy?

You can try using [@target] rather than [] as the final condition but I believe the phenomenon you’re referring to is a bug.

https://github.com/Stanzilla/WoWUIBugs/issues/382