tonywatsonhelp
Well-known Member
- Joined
- Feb 24, 2014
- Messages
- 3,210
- Office Version
- 365
- 2019
- 2016
- Platform
- Windows
Hi Everyone,
got a problem here.
I have 35 sheets all of which I need to run the same macro when I exit them.
but when I exit them they are no longer the active sheet so it all goes wrong.
i'm hoping there might be a way to change activesheet to something else and solve this any ideas?
below is the trigger and the macro
thanks
Tony
got a problem here.
I have 35 sheets all of which I need to run the same macro when I exit them.
but when I exit them they are no longer the active sheet so it all goes wrong.
i'm hoping there might be a way to change activesheet to something else and solve this any ideas?
below is the trigger and the macro
thanks
Tony
Code:
Private Sub Worksheet_Deactivate()
Call Employees
End Sub
Code:
Sub [LEFT][COLOR=#222222][FONT=Verdana]Employees[/FONT][/COLOR][/LEFT]()
TRow = 64
If ActiveSheet.Range("Y" & TRow) = "Acceptable" Then Exit Sub
LrowRD = Sheets("Employees").Cells(Rows.Count, "D").End(xlUp).Row + 1
If LrowRD < 6 Then
LrowRD = 6
End If
Sheets("Employees").Range("D" & LrowRD).Value = ActiveSheet.Range("D1").Value
Sheets("Employees").Range("E" & LrowRD).Value = ActiveSheet.Range("E" & TRow).Value
Sheets("Employees").Range("F" & LrowRD).Value = ActiveSheet.Range("W" & TRow).Value - ActiveSheet.Range("W" & TRow).Value - ActiveSheet.Range("W" & TRow).Value
End Sub