O
ordnance1
The code below switches to another workboo (which is already open) and runs
some code on that workbook to edit an employees name. Is there any way of
doing this without EmployeeList.xlsmactually displaying on the screen?
Private Sub Edit_Name_Click()
If ListBox1.Value = " " Then GoTo BlankList
Unload EmployeeList
Application.ScreenUpdating = False
Application.EnableEvents = False
Dim rng As Range, rng1 As Range
Dim sStr As String
Set rng = Workbooks("EmployeeList.xlsm").Worksheets("Employee_List").Cells
sStr = Me.TextBox1.Value
Set rng1 = rng.Find(What:=sStr, _
After:=Range("IV65536"), _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng1 Is Nothing Then
Workbooks("EmployeeList.xlsm").Activate
ActiveWorkbook.Worksheets("Employee_List").Activate
rng1.Select
Else
MsgBox sStr & " not found"
End If
Application.Run "EmployeeList.xlsm!UpdateName"
Application.ScreenUpdating = True
EmployeeList.Show
ThisWorkbook.Activate
Application.ScreenUpdating = True
Application.EnableEvents = True
BlankList:
End Sub
some code on that workbook to edit an employees name. Is there any way of
doing this without EmployeeList.xlsmactually displaying on the screen?
Private Sub Edit_Name_Click()
If ListBox1.Value = " " Then GoTo BlankList
Unload EmployeeList
Application.ScreenUpdating = False
Application.EnableEvents = False
Dim rng As Range, rng1 As Range
Dim sStr As String
Set rng = Workbooks("EmployeeList.xlsm").Worksheets("Employee_List").Cells
sStr = Me.TextBox1.Value
Set rng1 = rng.Find(What:=sStr, _
After:=Range("IV65536"), _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng1 Is Nothing Then
Workbooks("EmployeeList.xlsm").Activate
ActiveWorkbook.Worksheets("Employee_List").Activate
rng1.Select
Else
MsgBox sStr & " not found"
End If
Application.Run "EmployeeList.xlsm!UpdateName"
Application.ScreenUpdating = True
EmployeeList.Show
ThisWorkbook.Activate
Application.ScreenUpdating = True
Application.EnableEvents = True
BlankList:
End Sub