This might be of interest - @DanThomas’ macro
Could perhaps be used as a basis for developing something more “automatic”?
For more information, see the wiki Searching the Forum for Answers section.