Lloyd Velasquez says, "I often work with DWGs that have hundreds of xrefs. With this AutoLISP code, you type IDLAYR and select an object, then the layer name appears in the Command line."
(defun c:idlayr (/ LAY PIK STR)
(command "layer" "S" 0 "" )
(setq pik (nentsel "
Select a nested layer to id"))
(setq lay (assoc 8 (entget (car pik))))
(setq str (cdr lay))
NOTES FROM CADALYST TIP PATROL:
This tip works well. It should run just as well without the first line that changes to layer 0 (zero).