ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   flashing screen (https://www.excelbanter.com/excel-programming/324933-flashing-screen.html)

Paul

flashing screen
 
I have written the following code which displays a moving
series of data in a couple of charts. It works, but
there is a lot of flashing and flickering while it is
running. Can someone tell me how to eliminate the screen
flashing??

Sub xdayplayer()

Dim counter As Long
Dim begin As Long
Dim ending As Long
Dim cent As Long
'
Do

counter = Worksheets("DATA").[ah1].Value

begin = counter + 1
ending = counter + 781
cent = ending - 100
counter = counter + 1
Worksheets("DATA").[ah1].Value = counter

Application.ScreenUpdating = False

ActiveSheet.ChartObjects("Chart 21").Activate
ActiveChart.SeriesCollection(1).Values = "=DATA!R" &
cent & "C13:R" & ending & "C13"
ActiveChart.SeriesCollection(2).Values = "=DATA!R" &
cent & "C20:R" & ending & "C20"


ActiveSheet.ChartObjects("Chart 18").Activate
ActiveChart.SeriesCollection(1).Values = "=DATA!R" &
begin & "C17:R" & ending & "C17"
ActiveChart.SeriesCollection(2).Values = "=DATA!R" &
begin & "C24:R" & ending & "C24"

Application.ScreenUpdating = True

Loop While counter < 10000

End Sub

Harald Staff

flashing screen
 
Hi

Put
Application.ScreenUpdating = False
OUTSIDE your Do - While loop.

HTH. best wishes Harald

"Paul" skrev i melding
...
I have written the following code which displays a moving
series of data in a couple of charts. It works, but
there is a lot of flashing and flickering while it is
running. Can someone tell me how to eliminate the screen
flashing??

Sub xdayplayer()

Dim counter As Long
Dim begin As Long
Dim ending As Long
Dim cent As Long
'
Do

counter = Worksheets("DATA").[ah1].Value

begin = counter + 1
ending = counter + 781
cent = ending - 100
counter = counter + 1
Worksheets("DATA").[ah1].Value = counter

Application.ScreenUpdating = False

ActiveSheet.ChartObjects("Chart 21").Activate
ActiveChart.SeriesCollection(1).Values = "=DATA!R" &
cent & "C13:R" & ending & "C13"
ActiveChart.SeriesCollection(2).Values = "=DATA!R" &
cent & "C20:R" & ending & "C20"


ActiveSheet.ChartObjects("Chart 18").Activate
ActiveChart.SeriesCollection(1).Values = "=DATA!R" &
begin & "C17:R" & ending & "C17"
ActiveChart.SeriesCollection(2).Values = "=DATA!R" &
begin & "C24:R" & ending & "C24"

Application.ScreenUpdating = True

Loop While counter < 10000

End Sub




Tom Ogilvy

flashing screen
 
Sub xdayplayer()

Dim counter As Long
Dim begin As Long
Dim ending As Long
Dim cent As Long
'
Application.ScreenUpdating = False
Do

counter = Worksheets("DATA").[ah1].Value

begin = counter + 1
ending = counter + 781
cent = ending - 100
counter = counter + 1
Worksheets("DATA").[ah1].Value = counter



ActiveSheet.ChartObjects("Chart 21").Activate
ActiveChart.SeriesCollection(1).Values = "=DATA!R" &
cent & "C13:R" & ending & "C13"
ActiveChart.SeriesCollection(2).Values = "=DATA!R" &
cent & "C20:R" & ending & "C20"


ActiveSheet.ChartObjects("Chart 18").Activate
ActiveChart.SeriesCollection(1).Values = "=DATA!R" &
begin & "C17:R" & ending & "C17"
ActiveChart.SeriesCollection(2).Values = "=DATA!R" &
begin & "C24:R" & ending & "C24"



Loop While counter < 10000
Application.ScreenUpdating = True
End Sub

--
Regards,
Tom Ogilvy

"Paul" wrote in message
...
I have written the following code which displays a moving
series of data in a couple of charts. It works, but
there is a lot of flashing and flickering while it is
running. Can someone tell me how to eliminate the screen
flashing??

Sub xdayplayer()

Dim counter As Long
Dim begin As Long
Dim ending As Long
Dim cent As Long
'
Do

counter = Worksheets("DATA").[ah1].Value

begin = counter + 1
ending = counter + 781
cent = ending - 100
counter = counter + 1
Worksheets("DATA").[ah1].Value = counter

Application.ScreenUpdating = False

ActiveSheet.ChartObjects("Chart 21").Activate
ActiveChart.SeriesCollection(1).Values = "=DATA!R" &
cent & "C13:R" & ending & "C13"
ActiveChart.SeriesCollection(2).Values = "=DATA!R" &
cent & "C20:R" & ending & "C20"


ActiveSheet.ChartObjects("Chart 18").Activate
ActiveChart.SeriesCollection(1).Values = "=DATA!R" &
begin & "C17:R" & ending & "C17"
ActiveChart.SeriesCollection(2).Values = "=DATA!R" &
begin & "C24:R" & ending & "C24"

Application.ScreenUpdating = True

Loop While counter < 10000

End Sub





All times are GMT +1. The time now is 06:49 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com