ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Catching Ctrl+clicks and getting to the selection (https://www.excelbanter.com/excel-programming/410049-catching-ctrl-clicks-getting-selection.html)

Mac

Catching Ctrl+clicks and getting to the selection
 
Hello,
when a user changes the area of a selection (via a Ctrl+click), how do I
intercept this event and after that, how do I get to the selection object and
'read' what's in the selected parts (rows)? Thank you!

Dave Peterson

Catching Ctrl+clicks and getting to the selection
 
If you're only interested in a single worksheet, you could use the
Worksheet_selectionchange event.

If you want to try, rightclick on the worksheet tab that should have this
behavior. Select view code and past this into the code window:

Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim myArea As Range
For Each myArea In Target.Areas
MsgBox myArea.Address(0, 0)
Next myArea
End Sub

I'm not sure what you're doing, so I just did a message box of the address of
each area.


Mac wrote:

Hello,
when a user changes the area of a selection (via a Ctrl+click), how do I
intercept this event and after that, how do I get to the selection object and
'read' what's in the selected parts (rows)? Thank you!


--

Dave Peterson


All times are GMT +1. The time now is 12:55 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com