Get_Involved
Active Member
- Joined
- Jan 26, 2007
- Messages
- 383
I have this VB code in Module1
And this code in ThisWorkbook
This code is working.
I have 8 sheets in this workbook, and the code puts the clock on all 8 sheets when opening
How can I restructure the code to only run on Sheet2?
I have tried everything, then it doesn’t work at all.
Any help would be appreciated.
Code:
Dim TimerActive As Boolean
Sub StartTimer()
Start_Timer
End Sub
Private Sub Start_Timer()
TimerActive = True
Application.OnTime Now() + TimeValue("00:00:01"), "Timer"
End Sub
Private Sub Stop_Timer()
TimerActive = False
End Sub
Private Sub Timer()
If TimerActive Then
ActiveSheet.Cells(6, 3).Value = Date + Time
Application.OnTime Now() + TimeValue("00:00:01"), "Timer"
End If
End Sub
And this code in ThisWorkbook
Code:
Private Sub Workbook_Open()
Module1.StartTimer
End Sub
This code is working.
I have 8 sheets in this workbook, and the code puts the clock on all 8 sheets when opening
How can I restructure the code to only run on Sheet2?
I have tried everything, then it doesn’t work at all.
Any help would be appreciated.