VBA code to stop 'screen flashing'

ddander54

Board Regular
Joined
Oct 18, 2012
Messages
97
I have some VBA code that I turn screen updating off to keep the screen from flashing, then turn it on later just before I end, however part of my code is doing some copy pasting, so if I turn it on after I do the copy paste, I don't see any of the data that is copy/pasted. If I turn it on before I start the copy/paste, the cells get updated, but the user sees all the screen flashing as it does the copy paste. What am I doing wrong, or how can I resolve this?

Code:
Sub currentcode()

    With Application
       .ScreenUpdating = False
       .Calculation = xlCalculationManual
       .EnableEvents = False
    End With

.....do a bunch of stuff....

    With Application
       .ScreenUpdating = True
       .Calculation = xlCalculationAutomatic
       .EnableEvents = True
    End With

....do the copy pasting......

End Sub

Code:
Sub WhatIwouldlike()

    With Application
       .ScreenUpdating = False
       .Calculation = xlCalculationManual
       .EnableEvents = False
    End With

.....do a bunch of stuff....
....do the copy pasting......

    With Application
       .ScreenUpdating = True
       .Calculation = xlCalculationAutomatic
       .EnableEvents = True
    End With

End Sub

Thanks,
Don
 
Joe4,

Thanks for trying. The more I play with the code, the more I think the root of my problem is something else in the code, so I will start a new thread and will include the code there. Even tho' its related, the question might be different, so will start the new thread.

Don
 
Upvote 0

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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