View Full Version : Solved: Ontime event
I'm trying to find code for at opening the workbook if after 1 min sheet("1 Maint").range("a1") <> "ok" then close the workbook without saving..
If within 1 min the cell = "ok" then cancel the timer.
mbarron
04-23-2011, 08:23 PM
In the ThisWorkbook module
Private Sub Workbook_Open()
Application.OnTime Now() + TimeSerial(0, 1, 0), "CheckForOK"
End Sub
In a standard module:
Sub CheckForOk()
If UCase(Sheets("1 Maint").Range("a1")) <> "OK" Then
ThisWorkbook.Close False
End If
End Sub
Worked perfectly. Thanks.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.