+ Reply to Thread
Results 1 to 13 of 13

Msg Box Activates on any cell only want on specific cell

  1. #1
    Registered User
    Join Date
    07-11-2010
    Location
    Goddard, Kansas
    MS-Off Ver
    Office 365
    Posts
    21

    Msg Box Activates on any cell only want on specific cell

    I want to have a msg box popup if a condition is not met but still have the worksheet protected. When I click on any cell the msg box comes up instead of only on the specific cell.

    Here is my code:
    Please Login or Register  to view this content.
    Last edited by takisis666; 09-07-2010 at 11:00 PM.

  2. #2
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: Msg Box Activates on any cell only want on specific cell

    Hi Takisis,

    Please take a moment to read the forum rules, and then edit your thread to wrap your code within CODE tags. For example:

    [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE]

    will appear as this when done properly:
    Please Login or Register  to view this content.

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,378

    Re: Msg Box Activates on any cell only want on specific cell

    Hi takisis666,

    I"m not sure you want this logic statement:
    Please Login or Register  to view this content.
    Try instead
    Please Login or Register  to view this content.
    My bad logic sensor alarmed with a not or not.

    Hope that helps.

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Msg Box Activates on any cell only want on specific cell

    I suspect you're saying you want something like:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    07-11-2010
    Location
    Goddard, Kansas
    MS-Off Ver
    Office 365
    Posts
    21

    Re: Msg Box Activates on any cell only want on specific cell

    Sorry posted the wrong code. Here is the original code:
    Please Login or Register  to view this content.
    Last edited by takisis666; 09-08-2010 at 09:09 AM.

  6. #6
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Msg Box Activates on any cell only want on specific cell

    The code I posted was wrong anyway... see if below does what you want:

    Please Login or Register  to view this content.
    if you have more terms to account for there are better methods
    Last edited by DonkeyOte; 09-08-2010 at 06:35 PM. Reason: typo - booLock should have read boolLock (see post 11) - coding on the fly again...

  7. #7
    Registered User
    Join Date
    07-11-2010
    Location
    Goddard, Kansas
    MS-Off Ver
    Office 365
    Posts
    21

    Re: Msg Box Activates on any cell only want on specific cell

    That worked part way, but I need it to check the cell to see if it is equal to the 2 values and if it is not then display the message box and keep the range specified in the original code locked.

  8. #8
    Registered User
    Join Date
    07-11-2010
    Location
    Goddard, Kansas
    MS-Off Ver
    Office 365
    Posts
    21

    Re: Msg Box Activates on any cell only want on specific cell

    Can someone please help me with this?

  9. #9
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Msg Box Activates on any cell only want on specific cell

    Quote Originally Posted by takisis666 View Post
    That worked part way, but I need it to check the cell to see if it is equal to the 2 values and if it is not then display the message box and keep the range specified in the original code locked.
    Which is what that code does, no ?

    Note: VBA by default is case sensitive - so if you're able to enter values in E38 in mixed/lower case you should adjust the code accordingly (ie remove the sensitivity)

    If you can't get it to do what you want please post a sample with code in place so we can see in action.

  10. #10
    Registered User
    Join Date
    07-11-2010
    Location
    Goddard, Kansas
    MS-Off Ver
    Office 365
    Posts
    21

    Re: Msg Box Activates on any cell only want on specific cell

    Here is the file with the code so that you can see what it does.

  11. #11
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Msg Box Activates on any cell only want on specific cell

    Right - but the code suggested is not in the file...

    That said there's a typo in my suggestion booLock should of course be boolLock - when you replace your code adjust accordingly

  12. #12
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887

    Re: Msg Box Activates on any cell only want on specific cell

    ::cough cough Option Explicit cough cough::


  13. #13
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Msg Box Activates on any cell only want on specific cell

    ...the code had never made it to VBE I'm afraid so not an OE in sight !

    (my bad - again)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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