Results 1 to 3 of 3

Application.Wait not working

Threaded View

  1. #1
    Registered User
    Join Date
    07-18-2010
    Location
    Sunderland
    MS-Off Ver
    Excel 2007
    Posts
    1

    Application.Wait not working

    Hi All,

    This is my first post so please excuse me if its not in the right place, and thanks in advance to anyone who offers an answer.

    I am sure any answers will be of interest to many other users.

    A little background:

    I am using Excel 2007 to record live data from the internet. The data refreshes very quickly, and all seems to work fine......

    Except for one thing- I want to pause the Application for a specified period of time, E.G 30 seconds. After this time I want to fire a macro.

    The problem is, the Application.Wait function does not fire. When I attempt to change the code, it produces an error....

    Here's the code:


    [CODE}
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Not Intersect(Target, Range("E2,H2")) Is Nothing Then Exit Sub

    Application.EnableEvents = False



    If (Worksheets("Sheet2").Cells(2, 5).Value = "Recording") Then
    Worksheets("Sheet2").Range("A20") = Now()
    Application.Wait (Now + TimeValue("0:00:40"))

    ' I Have also tried the above line using "Now()" in the above line


    End If


    // Other code here


    'Stop any possible runtime errors and halting code

    On Error Resume Next

    'Turn off ALL events so the routine does not put the code into a loop.



    'Turn events back on

    Application.EnableEvents = True

    'Allow run time errors again

    On Error GoTo 0



    'End If


    End Sub

    [CODE]
    Last edited by Herbie1809; 07-19-2010 at 03:20 AM. Reason: unaware of forum rules-my first post

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1