Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Is there a double click event for cell? | Excel Discussion (Misc queries) | |||
Double-click Event question | Excel Programming | |||
Sheet After Double Click event? | Excel Programming | |||
Key modifier for double-click event? | Excel Programming | |||
Before Double Click Event | Excel Programming |