+ Reply to Thread
Results 1 to 8 of 8

How to make a macro confirmation box pop up only once.

  1. #1
    Registered User
    Join Date
    01-23-2013
    Location
    Nashville, Tennessee
    MS-Off Ver
    Excel 2010
    Posts
    5

    How to make a macro confirmation box pop up only once.

    Hello all,

    I am new to the forum as well as VBA, and I appreciate in advance any help I receive. I have a spreadsheet that gets data dumped in from another program. I need to delete every row in which column C has the text "TN VEN" or "TN QUAR". I have a data validation list that lets the user select which macro they want to run, and I have a worksheet change event that calls the macro when selected in my data validation list.

    I have added a confirmation box, but it keeps repeating for each instance found. For instance, if there are four instances in which column C contains "TN QUAR", I have to click Yes five times before the rows are deleted. How can I make it so that I only have to press Yes once? Here is my code:

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    07-31-2010
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    4,070

    Re: How to make a macro confirmation box pop up only once.

    I don't think the issue is with your message box. I think the issue is with the worksheet change event being triggered everytime you delete a row. You can disable this by turning off enable events

    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: How to make a macro confirmation box pop up only once.

    Maybe a filter option, instead of the loop?

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    01-23-2013
    Location
    Nashville, Tennessee
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: How to make a macro confirmation box pop up only once.

    Thanks stnkynts for the quick suggestion...I tried this, but perhaps I placed it wrong? I was no longer prompted for confirmation, and no rows were deleted. My code looked like this:

    Please Login or Register  to view this content.
    Quote Originally Posted by stnkynts View Post
    I don't think the issue is with your message box. I think the issue is with the worksheet change event being triggered everytime you delete a row. You can disable this by turning off enable events

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-23-2013
    Location
    Nashville, Tennessee
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: How to make a macro confirmation box pop up only once.

    Hi John,

    I tried this option...the first time I tried it, it worked well. I was prompted once to click yes, and all rows with "TN VEN" in column C. I ran it again, thinking nothing would happen because the data was already gone, but I got the prompt. I clicked "Yes" five times, before finally clicking "No" and it deleted my first five rows of data, including my column headers, which are in row 3.

  6. #6
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: How to make a macro confirmation box pop up only once.

    Maybe:

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    01-23-2013
    Location
    Nashville, Tennessee
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: How to make a macro confirmation box pop up only once.

    Perfect! Thanks so much!

    Quote Originally Posted by JOHN H. DAVIS View Post
    Maybe:

    Please Login or Register  to view this content.

  8. #8
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: How to make a macro confirmation box pop up only once.

    You're welcome. Glad to help out and thanks for the feedback.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Confirmation Image to pop up after successfull macro
    By ZeDoctor in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-21-2014, 06:37 AM
  2. how to over-ride the SAVE AS confirmation in a macro
    By alansusans in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-02-2013, 04:51 AM
  3. Macro to generate a confirmation box
    By hr536801 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-03-2011, 10:31 AM
  4. Skipping Confirmation Request in macro
    By aca in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-09-2011, 05:16 AM
  5. Confirmation Box before running a macro
    By randell.graybill in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-08-2009, 09:34 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1