Solved

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

Posted on 2014-11-12
3
74 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 29

Accepted Solution

by:
gowflow earned 500 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 29

Expert Comment

by:gowflow
ID: 40437563
Great !
gowflow
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
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.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

762 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

22 Experts available now in Live!

Get 1:1 Help Now