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

x
?
Solved

How do I ensure my Excel VBA application doesn't display each sheet as it processes them ?

Posted on 2014-11-12
3
Medium Priority
?
89 Views
Last Modified: 2014-11-12
Hi All,

My Excel application reads rows from one workbook and copies them to another. In fact, it processes each sheet in turn and depending on certain conditions selectively copies/pastes the rows to corresponding sheets.

The procedure opens an input workbook and an output workbook and amongst all this activity, the application switches from one sheet to another, opening a file and displaying the sheet that is currently active.

How do I stop this ? I want the procedure to run from the Menu sheet (click of a button) and all processing to be done in the background with the Menu sheet continually displayed until the end of the procedure.

I tried inserting Activate statements throughout the procedure but it got into a mess.

Is there a standard command which I can employ for this functionality.

Thanks
Toco
0
Comment
Question by:Tocogroup
  • 2
3 Comments
 
LVL 31

Accepted Solution

by:
gowflow earned 2000 total points
ID: 40437420
Put this in the start of the procedure:

'---> Disable Events
With Application
    .EnableEvents = False
    .ScreenUpdating = False
    .DisplayAlerts = False
End With

Open in new window



and just before the end of the sub put this
'---> Enable Events
With Application
    .EnableEvents = True
    .ScreenUpdating = True
    .DisplayAlerts = True
End With

Open in new window


This will ensure no fliquering and that you macro will execute the procedure and will not go to other events before it finishes

gowflow
0
 

Author Closing Comment

by:Tocogroup
ID: 40437554
Ah yes now I remember ! Thanks for that. Works perfectly
0
 
LVL 31

Expert Comment

by:gowflow
ID: 40437563
Great !
gowflow
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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 article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

782 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