select different excel sheet tab 1 by 1 select.sheet() and wait() for slidehshow

ijqureshi

New Member
Joined
May 18, 2008
Messages
25
Hi there

I have built a tool to display network performance graphs in excel this tool is extracting data from sql database after every 60 minutes These graphs are
displayed on main wall.I have created 3 sets of graphs as per requirement just like a slide show i would like to display these 3 sets of graphs i created on 3 tabs inside worksheet i have used wait function for this purpose with select.sheets() function in a macro its doing great and displaying 3 tabs 1 by by 1 in sequence.Now here is the real issue i am running this macro continuously and its worked as slideshow for me but unfortunately graphs are not updated dynamically when macro is running

I need you help to help me creating macro which can display slideshow without stopping database connection and refresh function

Option Explicit

Sub Wait(tSecs As Single)
' Timer to create a pause
Dim sngSec As Single

sngSec = Timer + tSecs
Do While Timer < sngSec
DoEvents
Loop
End Sub


Sub ExampleWait()
'
Dim x As Long

For x = 1 To 500000

Sheets("Sheet1").Select

Wait 2.5 'Delay for 2.5 second

Sheets("Sheet2").Select

Wait 2.5 'Delay for 2.5 second

Sheets("Sheet3").Select

Wait 2.5 'Delay for 2.5 second

Next x
End Sub

Challenge is on! sorry dont know how to attach file!
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
ok i have done it with refresh but all graphs disappeared for 20 secs of sheet 3 before switching to sheet 1 :biggrin:

here is the code!

Sub ExampleWait()
Dim newHour As Long
Dim newMinute As Long
Dim waitTime As Long
Dim newSecond As Long

Dim x As Long

For x = 1 To 500000

newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 5
waitTime = TimeSerial(newHour, newMinute, newSecond)
'Application.Wait waitTimeThis example displays a message indicating whether 10 seconds have passed.

If Application.Wait(Now + TimeValue("0:00:5")) Then
Sheets("Sheet1").Select
End If
If Application.Wait(Now + TimeValue("0:00:5")) Then
Sheets("Sheet2").Select
End If
If Application.Wait(Now + TimeValue("0:00:5")) Then
Sheets("Sheet3").Select
End If
Sheets("Sheet4").Select
ActiveWorkbook.RefreshAll

Next x
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,517
Messages
6,179,233
Members
452,898
Latest member
Capolavoro009

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top