Where to put DisplayAlerts = False

J

Joe Fish

Hi,
I have tried inserting DisplayAlerts = False all over the following
block of code , but when I go to delete the sheets, it still asks if I
want to delete them. Is this not the right syntax or am I doing
something wrong?
Thanks,
Joe Fish

Sub SetUpScrollerInfo()

DisplayAlerts = False
Run ("DeleteOldSheets")
Run ("MakeNewSheets")
Run ("ImportData")
Run ("FormatData")
Run ("AddToPositionAndUnitNumberFormula")
Run ("DefineBundles")
Sheets("Scroller Info").Range("A1").Select

End Sub
Sub DeleteOldSheets()

DisplayAlerts = False
Sheets("Scroller Info").Delete
DisplayAlerts = False
Sheets("Spare Scroller Cables").Delete
 
C

Chip Pearson

You need to qualify 'DisplayAlerts' with 'Application'. E.g,

Application.DisplayAlerts = False

Without the Application qualification, VBA treats 'DisplayAlerts'
as a variable name, creates the variable, and assigns it a value
of False. This would be obvious if you properly placed 'Option
Explicit' at the top of your code module.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
J

Jim May

change to:
Application.DisplayAlerts = False
Your code....
Application.DisplayAlerts = True
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top