Multi select with doubleclick event

M

matelot

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
 
J

JLGWhiz

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
 
N

NickHK

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
 
M

matelot

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top