|
-
Nov 29th, 2010, 03:38 PM
#3
Thread Starter
Lively Member
Re: Switch between Excel Sheets so many X seconds?
this is what I have far and is working other than I need it to pause before the macro runs. The reason for the pause is for some reason the cells don't update. If I open the spreadsheet manually then run the macro is works. Here is what I have:
Option Explicit
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Sub pause()
Dim pause As Worksheet
Do
For Each pause In ThisWorkbook.Worksheets
pause.Activate
Application.Wait Now + TimeValue("00:00:05")
End Sub
Public Sub Switch()
Dim ws As Worksheet
Do
For Each ws In ThisWorkbook.Worksheets
ws.Activate
Application.Wait Now() + TimeValue("00:00:05")
If GetAsyncKeyState(vbKeyShift) Then Exit Sub
DoEvents
Next ws
Loop
End Sub
Private Sub Workbook_Open()
ThisWorkbook.Switch
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|