screen flash during marco run

Y

ynissel

My macro copies and pastes a lot of data ranges between sheets and the screen
flashes as it does all this. I know there is a command to not have the
screen flash but I cant find it. Doesn anyone know it offhand?
Thanks,
Yosef
 
K

Kristina Conceicao

ynissel said:
My macro copies and pastes a lot of data ranges between sheets and the screen
flashes as it does all this. I know there is a command to not have the
screen flash but I cant find it. Doesn anyone know it offhand?
Thanks,
Yosef

I think you're probably looking for:
Application.ScreenUpdating = False

You can turn screen updating back on at the end of your macro by
substituting True for False.

HTH,

Kristina
 
Y

ynissel

Thanks.

Kristina Conceicao said:
I think you're probably looking for:
Application.ScreenUpdating = False

You can turn screen updating back on at the end of your macro by
substituting True for False.

HTH,

Kristina
 
J

JE McGimpsey

as Kristina points out, Application.ScreenUpdating = False will reduce
the flicker.

However, a better solution is to eliminate the cause of screen flicker
altogether. Instead of copying ranges from on sheet to another via
selections, e.g.:

Sheets("Sheet1").Activate
Range("A1:J10").Select
Selection.Copy
Sheets("Sheet2").Select
Range("A20").Select
Activesheet.Paste
Sheets("Sheet1").Select

you can work with the range objects directly. This usually produces
smaller, faster, and IMO easier to maintain code. For instance, the
above lines could be replaces with

Sheets("Sheet1").Range("A1:J10").Copy Destination:= _
Sheets("Sheet2").Range("A20")

One benefit, of course, is that since you're not selecting anything,
there's nothing for the screen to update - therefore no flicker.
 
Top