PDA

View Full Version : Solved: double click worksheet event limited to a worksheet range



vanhunk
05-09-2013, 07:36 AM
Hi there,

I have difficulty confining a worksheet double click event to a range on the worksheet. I want a macro to be launched if any cell is double clicked in columns D1 to K100, but nowhere else on the sheet.

Is it possible to limit a worksheet event to a block range like this?

Looking forward to your replies,

Thank you in advance

shrivallabha
05-09-2013, 07:47 AM
Like this:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("D1:K100")) Is Nothing Then
'Your code here
MsgBox "You clicked in Double Click Range!", vbExclamation
Cancel = True
End If
End Sub

vanhunk
05-09-2013, 11:50 PM
Thank you so much shrivallabha, it is exactly what I was looking for.

Have a great day :)