Solved

Using "ScreenUpdating"

Posted on 2016-10-12
6
66 Views
Last Modified: 2016-10-12
EE Pros,

I have a simple macro that when fired, causes a flicker as it runs.  I've tried to use the "Application.Screenupdating = False, but either have it in the wrong place or am not using the correct line of code.  Any help would be appreciated.

Sub RestoreValueProps()

On Error Resume Next

 With ActiveSheet
    Application.ScreenUpdating = False

.Range("G12") = "=I150"
.Range("G14") = "=I151"
.Range("G16") = "=I152"
.Range("G18") = "=I153"
.Range("G20") = "=I154"
.Range("G22") = "=I155"
.Range("G24") = "=I156"
.Range("G26") = "=I157"

End With

End Sub

Open in new window


Thanks in advance,

B.

Edit:  Code placed in snippet with thanks and Initial removed to end
GrahamSkan
0
Comment
Question by:Bright01
6 Comments
 
LVL 15

Accepted Solution

by:
Haris Djulic earned 300 total points
ID: 41840428
Try this

Sub RestoreValueProps()
Application.ScreenUpdating = False

On Error Resume Next

 With ActiveSheet
   
.Range("G12") = "=I150"
.Range("G14") = "=I151"
.Range("G16") = "=I152"
.Range("G18") = "=I153"
.Range("G20") = "=I154"
.Range("G22") = "=I155"
.Range("G24") = "=I156"
.Range("G26") = "=I157"

End With
Application.ScreenUpdating = True

End Sub
0
 
LVL 15

Assisted Solution

by:Haris Djulic
Haris Djulic earned 300 total points
ID: 41840435
Or

Application.ScreenUpdating = False
Call restorevalueprops()
Application.ScreenUpdating = True
0
 
LVL 46

Assisted Solution

by:Martin Liss
Martin Liss earned 100 total points
ID: 41840556
Are you aware that Application.ScreenUpdating is always True when debugging? Anyhow, your macro as written will trigger the Worksheet_Change event. Do you have an Application.ScreenUpdating = True line there?
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 18

Assisted Solution

by:Roy_Cox
Roy_Cox earned 100 total points
ID: 41840568
There is nothing in your code that would cause a screen to flicker, although you should restore ScreenUpdating to True at the end of the code because it will not restore itself.

There must be something else that is causing the flicker, your code runs fine for me without switching off ScreenUpdating
0
 

Author Closing Comment

by:Bright01
ID: 41840626
Great work!
0
 
LVL 18

Expert Comment

by:Roy_Cox
ID: 41841367
Pleased to help
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Excel Drop Down List 13 36
Excel - DATEDIF error #NUM 6 27
Excel - remove duplicates 1 16
multiple columns far out to BG need to transpose 6 20
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question