Tipster Dave Alexander shares a macro with us that will unlock a specific layer in AutoCAD and make it current.
"Efficiency with AutoCAD can be increased by reducing the number of mouse button clicks. Using tool button toggles to change from one layer to another layer and then back again is fun and efficient. Everyone has a specific layer for attaching xrefs. For instance, G-ANNO-REFR; this layer is usually locked. To manage your xrefs you have to make the G-ANNO-REFR layer current and unlock it. Now you can do what you need to do with the xrefs. When you are finished, you have to lock the layer and find your way back to the previous layer. The following is from a tool bar button that I have. You can assign it to a shortcut key, tool palette item, a menu item, or a toolbar button, which is my preference."
^C^C(IF (= (STRCASE (GETVAR "CLAYER")) "G-ANNO-REFR")
(progm (SETQ LA3 LA1)(command "-layer" "LO" "G-ANNO-REFR" "" ))
(progm (SETQ LA1 (GETVAR "CLAYER") LA3 "G-ANNO-REFR")
(command "-layer" "U" "G-ANNO-REFR" "" )));'-layer;M;!LA3;;;
Notes from Cadalyst Tip Reviewer Brian Benton: This macro is really quite simple. It makes the layer G-ANNO-REFR current and unlocks it. It sounds simple enough to do manually, but if you have to do this many times in your workflow it can be very frustrating. Add this bit of code to a tool palette, toolbar, the Quick Access toolbar, etc., and then it’s just a quick flick of the wrist and a click.