ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Multi select with doubleclick event (https://www.excelbanter.com/excel-programming/388091-multi-select-doubleclick-event.html)

matelot

Multi select with doubleclick event
 
I want the user to do a multi-select in a column using the ctrl+click and
doubleclick on the last selected row. Using the beforedoubleclick event on a
sheet doesn't capture the event at all. It only works when I double click on
1 cell.
Here's what I am using.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Cancel = True
If Intersect(Range("A:A"), Target) Is Nothing Then
Else
MsgBox ActiveWindow.RangeSelection.Address
End If
End Sub
Is the function "Range.Address" the only way to capture the different row in
the selection range? I just want to know the row that it's selected.

Can anyone help me.
Thanks

JLGWhiz

Multi select with doubleclick event
 
Not sure I understand what you are asking, but here is one way to return the
row number.

Sub rw()
MsgBox "Row is " & ActiveCell.Row
End Sub


"matelot" wrote:

I want the user to do a multi-select in a column using the ctrl+click and
doubleclick on the last selected row. Using the beforedoubleclick event on a
sheet doesn't capture the event at all. It only works when I double click on
1 cell.
Here's what I am using.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Cancel = True
If Intersect(Range("A:A"), Target) Is Nothing Then
Else
MsgBox ActiveWindow.RangeSelection.Address
End If
End Sub
Is the function "Range.Address" the only way to capture the different row in
the selection range? I just want to know the row that it's selected.

Can anyone help me.
Thanks


NickHK

Multi select with doubleclick event
 
When you double-Click it selects that cell.
Hence in your Worksheet_BeforeDoubleClick routine, Target will be only the
cell that was double-clicked, not the previous selection made with
CTRL+Click.

Maybe use the Worksheet_BeforeRightClick event instead.

NickHK

"matelot" wrote in message
...
I want the user to do a multi-select in a column using the ctrl+click and
doubleclick on the last selected row. Using the beforedoubleclick event on

a
sheet doesn't capture the event at all. It only works when I double click

on
1 cell.
Here's what I am using.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Cancel = True
If Intersect(Range("A:A"), Target) Is Nothing Then
Else
MsgBox ActiveWindow.RangeSelection.Address
End If
End Sub
Is the function "Range.Address" the only way to capture the different row

in
the selection range? I just want to know the row that it's selected.

Can anyone help me.
Thanks




matelot

Multi select with doubleclick event
 
Thanks for the response. I replace the event with Right-mouse click and it
works. I guess that's one way to implement it rather than double-click the
cell.

Thanks.

"NickHK" wrote:

When you double-Click it selects that cell.
Hence in your Worksheet_BeforeDoubleClick routine, Target will be only the
cell that was double-clicked, not the previous selection made with
CTRL+Click.

Maybe use the Worksheet_BeforeRightClick event instead.

NickHK

"matelot" wrote in message
...
I want the user to do a multi-select in a column using the ctrl+click and
doubleclick on the last selected row. Using the beforedoubleclick event on

a
sheet doesn't capture the event at all. It only works when I double click

on
1 cell.
Here's what I am using.
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Cancel = True
If Intersect(Range("A:A"), Target) Is Nothing Then
Else
MsgBox ActiveWindow.RangeSelection.Address
End If
End Sub
Is the function "Range.Address" the only way to capture the different row

in
the selection range? I just want to know the row that it's selected.

Can anyone help me.
Thanks






All times are GMT +1. The time now is 07:06 AM.

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