Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Double-click event question, part 2 (Excel 97)

(Excel 97)
I have coded a double-click event to print a particular portion of an
employee schedule, but I'm having trouble making it work for more than the
first employee. This one works fine:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
' Print Employee 001

If Not Intersect(Target, Range("Empl001")) Is Nothing Then
Range("A8:O10").Select
Selection.PrintOut Copies:=1, Collate:=True
Cancel = True
End If
End Sub


When I try to add another employee in, it will not work:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
' Print Employee 001

If Not Intersect(Target, Range("Empl001")) Is Nothing Then
Range("A8:O10").Select
Selection.PrintOut Copies:=1, Collate:=True
Cancel = True
End If

' Print Employee 002

If Not Intersect(Target, Range("Empl002")) Is Nothing Then
Range("A14:O16").Select
Selection.PrintOut Copies:=1, Collate:=True
Cancel = True
End If
End Sub

It is in the same procedure... am I putting it in the wrong place? If I try
to create more than one double click event on the page I get an ambiguous
procedure name error... I have at least 20 employees that I need to
accommodate.

Any help is, as always, greatley appreciated!

BW


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Double-click event question, part 2 (Excel 97)

Your code works fine for me in Excel 97.

The defined names are Empl (with an L) 001 and 002

Check to be sure. One might be Emp (then with a one) 1002

--
Regards,
Tom Ogilvy


"Bob Wall" wrote in message
...
(Excel 97)
I have coded a double-click event to print a particular portion of an
employee schedule, but I'm having trouble making it work for more than the
first employee. This one works fine:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
' Print Employee 001

If Not Intersect(Target, Range("Empl001")) Is Nothing Then
Range("A8:O10").Select
Selection.PrintOut Copies:=1, Collate:=True
Cancel = True
End If
End Sub


When I try to add another employee in, it will not work:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
' Print Employee 001

If Not Intersect(Target, Range("Empl001")) Is Nothing Then
Range("A8:O10").Select
Selection.PrintOut Copies:=1, Collate:=True
Cancel = True
End If

' Print Employee 002

If Not Intersect(Target, Range("Empl002")) Is Nothing Then
Range("A14:O16").Select
Selection.PrintOut Copies:=1, Collate:=True
Cancel = True
End If
End Sub

It is in the same procedure... am I putting it in the wrong place? If I

try
to create more than one double click event on the page I get an ambiguous
procedure name error... I have at least 20 employees that I need to
accommodate.

Any help is, as always, greatley appreciated!

BW




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a double click event for cell? Ayo Excel Discussion (Misc queries) 3 June 6th 08 12:18 AM
Double-click Event question Bob Wall Excel Programming 2 September 6th 04 03:21 AM
Sheet After Double Click event? Tom Ogilvy Excel Programming 0 July 27th 04 05:59 PM
Key modifier for double-click event? Byrt Martinez[_3_] Excel Programming 1 February 20th 04 08:00 PM
Before Double Click Event gregork Excel Programming 4 February 9th 04 09:17 AM


All times are GMT +1. The time now is 09:22 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"