B
Bob Wall
(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
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