Solved

Using "ScreenUpdating"

Posted on 2016-10-12
6
44 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
Comment Utility
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
Comment Utility
Or

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

Assisted Solution

by:Martin Liss
Martin Liss earned 100 total points
Comment Utility
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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 17

Assisted Solution

by:Roy_Cox
Roy_Cox earned 100 total points
Comment Utility
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
Comment Utility
Great work!
0
 
LVL 17

Expert Comment

by:Roy_Cox
Comment Utility
Pleased to help
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

728 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now