How to make a cast sequence target macro?

Elvenbane is generally correct. Targeting is a restricted action. In a macro, only secure commands by Blizzard can target, and they’ve made no command to /targetsequence.

That said, /click is a secure command by Blizzard, and a secure button can be set up to target. But I don’t believe it’s possible to target by name in the secure environment. You can target by unit quite easily.

So if the requirement is to target people by name regardless of whether they can be referenced as a unit, then we can stop here because this functionality doesn’t exist.

If you can reference these targets as units, then you can set up a secure button to /click that can cycle through them. I have a small addon called Cycle Arena that lets you “targetsequence” through arena enemies, party members, or raid members.

And this demonstrates how to target a random person in your group that could be adapted to do it sequentially:

So as long as the criteria remains that the target is referencable by a unit, and this reference does not change during combat, then an addon could make a /targetsequence with names in a macro. The addon could add a /click to the macro (only outside of combat), and the addon could attempt to map names to units (only outside of combat), and set up a sequence (only outside of combat) to target, in combat too if it was set up beforehand out of combat.