+ Reply to Thread
Results 1 to 6 of 6

How to restrict pop of message box inside multiple times when it is inside a for loop?

  1. #1
    Registered User
    Join Date
    05-30-2014
    Posts
    23

    How to restrict pop of message box inside multiple times when it is inside a for loop?

    Hi,
    I have a for loop in my code below , it will avoid copy pasting the wrong values into the excel cells. If we copy and paste one value in one cell , Message Box will pop-up once and it is fine. But when we copy paste multiple cells for example say 10 cells , then the message box will pop-up 10 times and need to press OK 10 times to close the message which is very hard if the no.of cells increase say 50 or 500.

    Is there any way to restrict this situation ? to pop-up only once though we copy multiple cells (which are wrong) and paste in sheet so that message will pop-up only once for all 10 or 50 or 500 cells

    For Each cl In rng.Cells
    If cl.Validation.Value = False Then
    MsgBox ("Error : Please select the correct values from the drop-down")
    End If
    Next

    Thanks
    mounika

  2. #2
    Valued Forum Contributor Miroslav R.'s Avatar
    Join Date
    05-16-2013
    Location
    NMnV, Slovakia
    MS-Off Ver
    Excel 2007
    Posts
    479

    Re: How to restrict pop of message box inside multiple times when it is inside a for loop?

    Hi there,

    maybe:

    Please Login or Register  to view this content.
    Does it help?
    Regards
    Miroslav R.

    (If You like my solutions, feel free to add reputation.)

  3. #3
    Registered User
    Join Date
    05-30-2014
    Posts
    23

    Re: How to restrict pop of message box inside multiple times when it is inside a for loop?

    Hi,
    I have a for loop in my code below , it will avoid copy pasting the wrong values into the excel cells. If we copy and paste one value in one cell , Message Box will pop-up once and it is fine. But when we copy paste multiple cells for example say 10 cells , then the message box will pop-up 10 times and need to press OK 10 times to close the message which is very hard if the no.of cells increase say 50 or 500.

    Is there any way to restrict this situation ? to pop-up only once though we copy multiple cells (which are wrong) and paste in sheet so that message will pop-up only once for all 10 or 50 or 500 cells

    Please Login or Register  to view this content.
    Thank
    Mounika

  4. #4
    Valued Forum Contributor Miroslav R.'s Avatar
    Join Date
    05-16-2013
    Location
    NMnV, Slovakia
    MS-Off Ver
    Excel 2007
    Posts
    479

    Re: How to restrict pop of message box inside multiple times when it is inside a for loop?

    see post #2

  5. #5
    Registered User
    Join Date
    05-30-2014
    Posts
    23

    Re: How to restrict pop of message box inside multiple times when it is inside a for loop?

    Thanks Miroslav R. It helped me thank you thank you

  6. #6
    Valued Forum Contributor Miroslav R.'s Avatar
    Join Date
    05-16-2013
    Location
    NMnV, Slovakia
    MS-Off Ver
    Excel 2007
    Posts
    479

    Re: How to restrict pop of message box inside multiple times when it is inside a for loop?

    You are welcome!

+ 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. Multiple If statements inside a for loop error
    By pvhs07 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-11-2013, 01:00 PM
  2. [SOLVED] PERSONAL.XLSB error message when open multiple instances of Excel 2010 inside Caseware
    By RBoffice in forum Excel Programming / VBA / Macros
    Replies: 24
    Last Post: 12-18-2012, 06:31 PM
  3. Replies: 1
    Last Post: 10-02-2012, 04:27 PM
  4. VBA For loop where number of iterations can be changed from inside loop
    By barrboy89 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-11-2011, 12:18 PM
  5. 'Loop without do' error message (code inside)
    By Jeroen1000 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-23-2009, 07:16 AM

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