In an Excel formula can the clock be used to measure time?

C

Charlie Betz

I am developing an Excel model that tests the participant's memory.
Commencing the program makes a sheet visible. I want to use a
"Worksheet_Change macro to hide the sheet after a specified period of time
(between 30 & 90 seconds). Can the computer's clock be associated with a
formula so that I can cause a value in a cell to change at the conclusion of
a selected period? I am using Windows XP Home with Office 07.
 
G

Gary Keramidas

this should hide the sheet after 2 seconds after A1 is changed


Private Sub Worksheet_Change(ByVal Target As Range)
Const WSrange As String = "A1"
Dim i As Long
If Not Intersect(Target, Me.Range(WSrange)) Is Nothing Then
Application.Wait (Now + TimeValue("0:00:02"))
ActiveSheet.Visible = xlHidden
End If

End Sub
 
G

Gary Keramidas

don't need the dim statement, put it there by mistake


Private Sub Worksheet_Change(ByVal Target As Range)
Const WSrange As String = "A1"
If Not Intersect(Target, Me.Range(WSrange)) Is Nothing Then
Application.Wait (Now + TimeValue("0:00:02"))
ActiveSheet.Visible = xlHidden
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top