Active Member
June 24, 2016
Hi,
I have created an Exam Sheet where I want to run the timer and the user can finish the exam or auto closed when time up. After that file should be autosaved with password protection. Please find the attached file for your reference. I am facing the following issues:
1) The timer is not running if I press = sign, after pressing enter key it will aging running properly
2) User will not be allowed to insert or delete any new sheet
3) Range Protection should apply after starting the timer
4) The file should be auto-saved with a password
Please help me to fix these issues. If any other information are required please let me know.
Thanks & Regards,
Biplab Chandra
Trusted Members
December 20, 2019
1) The timer is not running if I press = sign, after pressing enter key it will aging running properly - Not sure what this means? Do you want the timer to start from you pressing the = key?
2) User will not be allowed to insert or delete any new sheet - might be easier to just delete any sheet they add, just run a quick loop on the sheets and any worksheet that isnt recognised delete it?
3) Range Protection should apply after starting the timer - What range needs to be protected?
4) The file should be auto-saved with a password - You should be able to replace Where you have MsgBox ("Time Completed"), with
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs "f:\Results", FileFormat:=52, Password:="Bananas"
Application.DisplayAlerts = True
ActiveWorkbook.Close True
Active Member
June 24, 2016
Thanks for your response!
1) The timer is not running if I press = sign, after pressing enter key it will aging running properly - Not sure what this means? Do you want the timer to start from you pressing the = key?
Ans: In the attached spreadsheet if anyone clicks on the Start Test button the time has started and my code is working properly. The timer has run properly on the working sheet tab. But whenever I press = sign then the timer is not running and if I press enter key then again it started. The Timer should not stop in any case.
2) User will not be allowed to insert or delete any new sheet - might be easier to just delete any sheet they add, just run a quick loop on the sheets and any worksheet that isnt recognised delete it?
Ans: I tried but code is not running in protected mode. It would be a great help if you add this to my code.
3) Range Protection should apply after starting the timer - What range needs to be protected?
Ans: I wanted to protect the timer button and the range of the first 2 sheets of data and workingsheet tab.
I am summaries my requirements:
- Users can click on a button to start the work.
- After that 3 sheets will open and in all 3 sheets user can see the same timer. The first sheet will hide automatically after click on the button.
- Users can close the file or file will be autoclosed if time over.
- Users can not able to delete or insert any sheet. Some range would be protected for the user.
Trusted Members
December 20, 2019
Number 1 - The timer appears to pause if any button is pressed and you sit in the cell. I assume this is because the timer is running in the sheet? I will look at this later
Number 2 - For checking sheet Names
Sub CheckSheets()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Sheets
Select Case ws.Name
Case "Home", "Data", "WorkingSheet", "ScoreBoard"
GoTo xfor
Case Else
Application.DisplayAlerts = False
ws.Delete
Application.DisplayAlerts = False
End Select
xfor:
Next ws
End Sub
Active Member
June 24, 2016
Hi Dear,
Thanks for your effort and response.
Number 1 - The timer appears to pause if any button is pressed and you sit in the cell. I assume this is because the timer is running in the sheet? I will look at this later - Yes, you are right. Please help me to run the timer directly in any button or text box so that it will run without any pause. The timer format should be HH:MM:SS.
1 Guest(s)