I have a Worksheet that contains a picture and a table. I also have a UserForm that acts as a countdown timer. The UserForm contains the following piece of code:
Option Explicit
Const AllowedTime As Double = 10 ' Total time in minutes
Private Sub UserForm_Activate()
Dim T, E, M, S As Double
T = Timer
Do
E = CDbl(Time) * 24 * 60 * 60 - T
M = AllowedTime - 1 - Int(E / 60)
S = 59 - Round((E / 60 - Int(E / 60)) * 60, 0)
TimeLabel.Caption = Format(CStr(M), "00") & ":" & Format(CStr(S), "00")
DoEvents
Loop Until (Timer - T) / 60 >= AllowedTime
MsgBox "Time Over!"
Unload Me
End Sub
The above code is not mine. I found it on an Excel forum. It just displays a countdown timer of 10 minutes, and when the time runs out, the userform unloads.
The problem is that while the userform is running, when I click the picture or the table in the worksheet, the Picture Tools/Table Tools that normally appear on the ribbon does not appear. I inserted a chart, and the Chart Tools doesn't appear too.
I found out that when I run the userform by commenting out the above timer code, everything works perfectly. I tried opening the Excel file in 3 different PCs, and all of them showed the same problem. Is there anything wrong with the timer code?
