You can’t make a macro to select the “tank” that’s general use. Either set the tank as focus or have it target the tanks name in particular and change the macro for every dungeon/raid. There is a macro for this on wowhead/icy veins
I use a similar macro but I also have one that sets my target as the focus that I use on the tank at the start of the run. Allows some flexibility as I can also set the healer as my focus on the fly if he gets into trouble.
Check the UI & Macros forum, I have a massive guide on all things macros (Macros: Essential Information). If you want a specific macro, post over there, I or one of the other macro people can help you write it (or tell you why its impossible or a terrible idea).
A friendly character named TankName-TankServer who must be in your group
Your pet
Default targeting - the cursor gets a blue highlight and you click on any unitframe after pressing the keybind to apply it to that person
If anything in the priority listing is either not there, dead, an enemy, or mind controlled, it will fall down to the next possible target in the list.
Yes there will be points that your target will jump from the tank but if you are watching your targets target when you cast it should hit the tank or the off tank.
Also that runs a major risk of mistiming the key press after a tank death and Misdirecting the healer or top melee DPS, instead of the offtank or a ret/arms/fury throwing in a shield to hold it together for a second until the tank can take a brez.
Unless you know the specific name of the tank, there’s no such unit or anything as a tank that you can use for macros. However, there’s always a workaround!