Complete Delete

  • Thread starter Thread starter Grace
  • Start date Start date
G

Grace

I have a macro which recorded me selecting sheets, then, I record the right
click and hit delete. Then I hit the delete button, but I don't see that it
records anything when I confirm the delete, by hitting the delete button.
How do I tell the macro to confirm the delete operation. Here is the macro
I recorded.

Sheets("Comments").Select
ActiveWindow.ScrollWorkbookTabs Position:=xlLast
Sheets(Array("Comments", "Dispersion", "BOPSummary",
"EOPSummary")).Select
Sheets("EOPSummary").Activate
ActiveWindow.SelectedSheets.Delete
 
Application.DisplayAlerts = False
Sheets(Array("Comments", "Dispersion", "BOPSummary", _
"EOPSummary")).Delete
Application.DisplayAlerts = True

HTH
Paul
 
Grace,

You actually don't confirm the delete, instead you skip the confirmation
prompt altogether.
Use the DisplayAlerts property to turn off the prompt, then turn it back on
after the delete:

Application.DisplayAlerts = False
ActiveWindow.SelectedSheets.Delete
Application.DisplayAlerts = True

hth,

Doug Glancy
 
Please understand that this is not meant to come across as
rude or derogatory.

Based on the number of posts you've sent recently, and the
nature of the questions you have asked, perhaps the best
solution for you would be to go to the person that tasked
you with creating/amending the macros and tell them that
you do not have the required knowledge of VBA to do so.
If someone says "Put this at the top of your code module"
and you need to ask "What's a code module?", you shouldn't
be developing important tools for your business.

Stop coding now, nip down to a bookstore and pick up any
of John Walkenbach's books on VBA programming in Excel.
He's written a few, they're all good, and most importantly
they will give you a base level of knowledge to go forward
with.
 
Dear anonymous (and everyone else who, understandably, feels as he does):

In hindsight, if I had known it would be this difficult to learn and I would
be such an imposition on the group, I might not have done all this. It does
seem clear that one should have more knowledge than I had, as the answers
seem to presume it. Truth to tell, I am in one of those situations where it
simply had to be turned around quicker than I could ever learn via a
textbook. I actually did 85% of the coding myself, it was the last 15% for
which I needed help. As you can probably tell from the hours of my posts, I
have had very little sleep the last week. If this product weren't deemed
highly proprietary and the data within, client sensitive, I would have been
SOOOO tempted to ask one of you smart and nice folk to do it for me, paying
for it out of my own pocket, despite the fact that my financial situation is
les than stellar now. Also, I hate to be at the mercy of someone else's
code, should they not be available, say, a year from now. So, I felt like I
had to put myself through this experience and learn, which I did.

Here's the good
I am waiting on clarifications on two posts (Closing non EXCEL files and
Code Help) and, after that, I should have very, very few questions left. I
hope you are not one of the respondents on those two points. Since you have
posted this anonymously - that is the only thing I find rude, your critique
is, otherwise, surely justified - I cannot know not to bother you again.
You all may not hear from me for a long time after this is done (obviously,
this is not my area of expertise) and, if there is a next time, I will read
the book.

The underlying file is so, so complex, it would be impossible to get the
result right if the code is wrong. And I do test my macro-driven results
against 100s of results I've already done manually. At this point, it is
working flawlessly, though I am still hoping for those two refinements.

Despite a few of the questions, I have learned a LOT.

I am truly indebted to everyone who has been so helpful! I apologize to
anonymous and everyone else I have angered.

Thank you all VERY MUCH!
Grace
 

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

Similar Threads


Back
Top