G
Guest
I have a form that when I enter an employee # it automatically changes the #
to the employee's name. I'd like to use this same code a number of other
times on this form for other applications that have nothing to do with the
employee and #. Can I have more then 1 piece of code on a form??
Thanks
Jon
My current code is:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Target.Column = 8 Then
If Target.Value = "" Then Exit Sub
Application.EnableEvents = False
Target.Value = Worksheets(".").Range("F1") _
.Offset(Application.WorksheetFunction _
.Match(Target.Value, Worksheets(".").Range("Employee_ID"), 0), 0)
Application.EnableEvents = True
End If
End Sub
to the employee's name. I'd like to use this same code a number of other
times on this form for other applications that have nothing to do with the
employee and #. Can I have more then 1 piece of code on a form??
Thanks
Jon
My current code is:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Target.Column = 8 Then
If Target.Value = "" Then Exit Sub
Application.EnableEvents = False
Target.Value = Worksheets(".").Range("F1") _
.Offset(Application.WorksheetFunction _
.Match(Target.Value, Worksheets(".").Range("Employee_ID"), 0), 0)
Application.EnableEvents = True
End If
End Sub