Excel: get selection screen coordinates (selected cells)

Post your working scripts, libraries and tools
User avatar
Posts: 4508
Joined: 19 Dec 2016, 01:58
Location: UK

Excel: get selection screen coordinates (selected cells)

14 Sep 2017, 02:05

Get selection screen coordinates and show a temporary border around the selection.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Useful links:
How to get X Y screen coordinates of Excel cell/Range
Posts: 193
Joined: 24 Jun 2015, 23:38

Re: Excel: get selection screen coordinates (selected cells)

19 Sep 2017, 00:13

Interesting idea. I like the proof of concept on translating screen coordinates, that may come in handy.

Functionally, this doesn't do so well when the selected cell is off-screen (which would go for any highlight mechanism, except for in this case, the code draws a highlight box on top of the ribbon for example).

I use the built-in highlighting function : ) Ctrl+A : )

More specifically, when searching for something (using the find/replace dialog), I trigger Ctrl+A after any kind of user selection change in the results list, so not only does the cell get highlighted as normal (with the normal selection box), but then the rest of the sheet goes dark so you can find the light/white cell on a fully darkened sheet. Works best on busy worksheets but a neat little trick since that's not really what Ctrl+A would normally be used for.

Return to “Scripts and Functions”

Who is online

Users browsing this forum: ahklearner, arcticir, DutchPete, JJohnston2 and 7 guests