VBA - surely this should not be happening

Siyanna

Well-known Member
Joined
Nov 7, 2011
Messages
1,146
Hi

I have 2 form controls where i have attached some code to update some charts on my sheet..

For some reason even after turnimg the screen updating off, it hides all my ovjects and charts before updating all the charts so its like you can see that the charts and most objects get hidden whilst the code is running

I dont like this slight twitch effect and wanted to get around this

I am using excel 2013

I have even put DoEvents but that dont make any difference

This is my code
Code:
Sub changechart()

Application.screenupdating=false


Dim i As Long

For i = 1 To 5
Worksheets("DailyView2").ChartObjects("Chart0" & i).Activate
With ActiveChart
.SeriesCollection(3).Format.Line.DashStyle = msoLineSysDot
.SeriesCollection(3).Border.Color = RGB(128, 128, 128)
.SeriesCollection(3).Format.Line.Weight = 1.5
.SeriesCollection(4).Format.Line.DashStyle = msoLineSysDot
.SeriesCollection(4).Border.Color = RGB(0, 0, 0)
.SeriesCollection(4).Format.Line.Weight = 1.5
End With
Next i


Application.screenupdating=true

End sub
 
Last edited by a moderator:

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
What happens if you don't try and activate the chart?

Code:
Sub changechart()

Application.ScreenUpdating = False

Dim i As Long

For i = 1 To 5
    With Worksheets("DailyView2").ChartObjects("Chart0" & i)
        .SeriesCollection(3).Format.Line.DashStyle = msoLineSysDot
        .SeriesCollection(3).Border.Color = RGB(128, 128, 128)
        .SeriesCollection(3).Format.Line.Weight = 1.5
        .SeriesCollection(4).Format.Line.DashStyle = msoLineSysDot
        .SeriesCollection(4).Border.Color = RGB(0, 0, 0)
        .SeriesCollection(4).Format.Line.Weight = 1.5
    End With
Next i

Application.ScreenUpdating = True

End Sub

WBD
 
Upvote 0
Ive researched and still have not found a solution- it flickers on charts even though screenupdating is false
 
Upvote 0
Are the forms still visible when the chart updating code runs? Try hiding them before Sub changechart()
 
Upvote 0
Are you saying after I changed my combo form selection - hide the combo form boxes ad unhide at the end?
 
Upvote 0
Are you saying after I changed my combo form selection - hide the combo form boxes ad unhide at the end?

Worth trying, the object may not be seen as part of the Excel screen so disabling updating may not disable the refresh of the object (userform) itself, only the sheet. Is a guess, no idea if this is true or not.
 
Upvote 0

Forum statistics

Threads
1,224,749
Messages
6,180,731
Members
452,995
Latest member
isldboy

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