Double-click Event question

  • Thread starter Thread starter Bob Wall
  • Start date Start date
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
 
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
 
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
 

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

Back
Top