Unlock sheet temporarily for 30 minutes

anihak

New Member
Joined
Oct 6, 2010
Messages
29
Ok, so here's the macro that I have:

Code:
Sub DisableTimer()
On Error Resume Next
Application.OnTime EarliestTime:=CountDown, Procedure:="Reset", Schedule:=False
End Sub


Sub Reset()
    Dim count As Long
    Dim sheet As Worksheet

'Set sheet = Sheets("Reg")
    count = 2
    count = count - 1
    If count <= 0 Then
         sheet.Protect DrawingObjects:=False, Contents:=True, Scenarios:= _
        False
         MsgBox "Time out."
        Exit Sub
    End If
    Call Timer
End Sub


Sub timer2()

Dim sheet As Worksheet
Dim CountDown As Date

CountDown = Now + TimeValue("00:00:01")
Set sheet = Sheets("Reg")

Application.OnTime CountDown, "Reset"

End Sub

I have 2 problems with that macro:

1-The macro never show the "Time out" message box at the end of the count down. I need the countdown to last 30 minutes, but it seems that whatever time value I put, it doesn't count in real time.:confused:

2-While the macro is running, I cannot go in other workbooks, because the macro doesn't find sheet "Reg". However, I need to be able to switch between workbooks when the macro is running. I think the best way to do that is to put the 3 macros together... But I don't know how.:confused:

Thank you!!!
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Forum statistics

Threads
1,224,600
Messages
6,179,836
Members
452,947
Latest member
Gerry_F

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top