Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Using "ScreenUpdating"

Posted on 2016-10-12
6
Medium Priority
?
112 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 1200 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 1200 total points
ID: 41840435
Or

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

Assisted Solution

by:Martin Liss
Martin Liss earned 400 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 22

Assisted Solution

by:Roy Cox
Roy Cox earned 400 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 22

Expert Comment

by:Roy Cox
ID: 41841367
Pleased to help
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Microsoft's Excel has many features that most people will never need nor take advantage of.  Conditional formatting is one feature that you may find a necessity once you start using it.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

963 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