Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: Pause a script

  1. #1
    New Member
    Join Date
    Apr 2002
    Location
    Memphis
    Posts
    12
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I have a macro in which I want to include a code to halt or freeze the steps for 15 seconds then continue without any user intervention. Excel help wasn't that helpful. This is as far as I have made it:

    Sub Viewit()
    '
    ' Macro
    '
    '

    Application.ScreenUpdating = False
    Sheets("View").Visible = True
    Sheets(Array("FinalReport", "Alloc Rates", "Variances", "Misc")).Select
    Sheets("FinalReport").Activate
    ActiveWindow.SelectedSheets.Visible = False
    Sheets("View").Select
    ActiveWindow.Zoom = 200
    Application.ScreenUpdating = False
    With ActiveWindow
    .DisplayGridlines = False
    .DisplayHeadings = False
    End With
    Application.ScreenUpdating = True

    'I want to pause the script for 15 seconds at this point


    Application.ScreenUpdating = False
    With ActiveWindow
    .DisplayGridlines = True
    .DisplayHeadings = True
    End With
    Application.ScreenUpdating = True
    ActiveWindow.Zoom = 100
    Sheets("View").Visible = True
    Sheets("Misc").Visible = True
    Sheets("Variances").Visible = True
    Sheets("Alloc Rates").Visible = True
    Sheets("FinalReport").Visible = True
    Sheets("View").Select
    ActiveWindow.SelectedSheets.Visible = False
    Application.Goto Reference:="Go2BUTTONS"
    Application.ScreenUpdating = True

    End Sub

  2. #2
    Board Regular zacemmel's Avatar
    Join Date
    Apr 2002
    Location
    Redmond, WA
    Posts
    636
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Use the timer control.

  3. #3
    Board Regular
    Join Date
    Apr 2002
    Location
    Greenwood, SC
    Posts
    677
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Put this in your code to get a 15 second pause:

    newHour = Hour(Now())
    newMinute = Minute(Now())
    newSecond = Second(Now()) + 15
    waitTime = TimeSerial(newHour, newMinute, newSecond)
    Application.Wait waitTime

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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