Turning off the gui update during vba run

plawton

New Member
Joined
Apr 23, 2002
Messages
1
Is there a way to turn off the update of the user interface while running a vba program? Specifically, I am trying to import a series of *.csv files and copy them into the same workbook together. It runs slow and looks bad because you see every action as it goes through the opening and copying procedure. Any ideas would be helpful. Thanks.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
First line of your macro should be :

Application.ScreenUpdating = False

But you must turn it back on at the end :

Application.ScreenUpdating = True
 
Upvote 0
I have used this many times, and found it not to be necessary to add the statement at the end of the macro, seems to work fine. Is this a problem waiting to happen?
 
Upvote 0
Not sure. I've also left it off accidently & not had any problems, but as I've been told quite a few times THAT YOU MUST TURN IT BACK ON I didn't want plawton to use it & then find a problem.
I guess it's just "good practice" to turn things back on after you've turned them off (like calculation ).
 
Upvote 0
I seldom reset screenupdating back to True.

You have to know when to do it. Basically, if control gets returned to Excel at the end of the macro, i.e. the code stops running, then there's no need to turn screenupdating back on because Excel will return to default. (i.e. TRUE)

However, you can get screwed quite easily and this is the only example I have of this.

Create a userform, doesn't matter what it's called and use this code to show it:

<pre>

Application.ScreenUpdating = False
Userform1.Show 'Or whatever your form is called</pre>

Start moving the form around and you'll be "painting" it all over the screen. This is not necesarily a problem, so long as you know what userform is yours. (ok it is a problem because it's a bug that we've created). This feature is particularly fun when you use "modeless" userforms and use a form to display another.

Anyway, I hope this helps. (if you're evil, like me, it's also a laugh to alter someone's code to do this, just to see how long it takes them to fix it)
 
Upvote 0

Forum statistics

Threads
1,213,494
Messages
6,113,986
Members
448,538
Latest member
alex78

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