Range detection in Vanilla does not work with the exceptions of a few API based ranges, for example spell range (usually 30 yards) or visible range (100 yards).
The C'Thun Warner addon (
http://armory.digam.dk/?sa=download.fil ... p1=8&p2=45) works using the trade range (11 yards), but it is not possible to alter this range to e.g. 5 yards.
I believe accurate range check was added in TBC, although I am not 100% sure about that.
There are some 3rd party libraries available which
estimate the range, but they are also not accurate.