As JDoubleU00 said you can use this in a macro:
Code:
/targetenemyplayer [@arena1, exists]
/targetenemy [@arena1, noexists]
If you don't want to waste a macro slot, you could make a small addon instead:
Code:
local header = CreateFrame('Frame', nil, nil, 'SecureHandlerStateTemplate')
header:SetAttribute('unit', 'arena1')
header:SetAttribute("_onstate-unitexists", "self:SetBinding(nil, 'TAB', newstate and 'TARGETNEARESTENEMYPLAYER' or 'TARGETNEARESTENEMY')")
RegisterUnitWatch(header, true)
And here is another option that can be much more versatile if needed (full macro conditionals, multiple binds):
Code:
local header = CreateFrame('Frame', nil, nil, 'SecureHandlerStateTemplate')
header:SetAttribute("_onstate-Bind-TAB", "self:SetBinding(nil, 'TAB', newstate)")
RegisterStateDriver(header, "Bind-TAB", "[@arena1, exists] TARGETNEARESTENEMYPLAYER; TARGETNEARESTENEMY")