Double-click Event question

B

Bob Wall

(Excel 97)
I am trying to code a print function, so that when a user double clicks on a
named range, certain rows of the worksheet are printed. No problem with the
printing aspect, but I'm having trouble getting the double click event to
work. I prefer to used named ranges instead of the value of the particular
cells to make it more generic, also so I don't have to change the code if
the cell value changes.

Thanks in advance!

BW
 
V

Vasant Nanavati

In the worksheet's code module:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
Cancel = True
If Not Intersect(Target, Range("MyNamedRange")) Is Nothing Then
'your print code here
End If
End Sub
 
B

Bob Wall

Works perfectly, thanks so much!

BW


Vasant Nanavati said:
In the worksheet's code module:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
Cancel = True
If Not Intersect(Target, Range("MyNamedRange")) Is Nothing Then
'your print code here
End If
End Sub
 
Top