+ Reply to Thread
Results 1 to 5 of 5

►[SOLVED] by Richard Buttrey - Message Box Error when Adjacent Cells Equal

  1. #1
    Registered User
    Join Date
    07-26-2012
    Location
    _
    MS-Off Ver
    Excel 2010
    Posts
    31

    Question ►[SOLVED] by Richard Buttrey - Message Box Error when Adjacent Cells Equal

    My goal is that A2 is not allowed to equal B2 and A3 cannot equal B3 and so on and so forth. This would be perfect if I could use data validation in order to get my error message, however dv only worked after I went into a cell that had a "a" and clicked enter.

    It is predicated on the following vba code (not mine) therefore if a cell is double clicked it will populate an "a" in marlett font, which shows up as a ✓

    Please Login or Register  to view this content.
    Would it be possible to have the above code be contigent upon if the cell adjacent to the active cell is "" then target.value = "a" I believe this would be difficult because the active cell could be in column A or B and then the adjacent cell would be B or A.

    If that code was possible then there would be a corresponding error message if there was an "a" in A2 and I double clicked B2 or visa a versa.

    Thanks in advance for your help!
    Attached Files Attached Files
    Last edited by xsoldoutx; 09-13-2012 at 08:15 AM.

  2. #2
    Forum Moderator Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    27,144

    Re: ► Message Box Error when Adjacent Cells Equal

    Must admit I'm not sure whether I fully understand you but I suspect the answer is Yes. You can always detect which column is being clicked and react accordingly.

    However upload another example with some manually created results and some notes explaining how you arrived at the result.

    Incidentally in your conditional formats A2=B2 is commutative (in maths parlance). i.e. A2=B2 implies that B2=A2, hence you don't need the OR test. Nor indeed do you need an IF test.

    =A2=B2 will suffice since this automatically results in either a True or False
    Richard Buttrey

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    07-26-2012
    Location
    _
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: ► Message Box Error when Adjacent Cells Equal

    Ok I believe I can explain it better without another upload, but I will be willing to do so if you do decide to respond/request again.

    • Please reference in A2 & B2 both cells contain "a" I would like the new code to incorporate an error message and not allow an individual to do this; they must only have an "a" in one or the other, not both.

    • Please reference the rest of the rows (3:17) for correct examples of how I would like the spreadsheet to function given the parameters I set above.

    Thanks for your help/response it is much appreciated.
    Last edited by xsoldoutx; 09-12-2012 at 11:02 AM.

  4. #4
    Forum Moderator Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    27,144

    Re: ► Message Box Error when Adjacent Cells Equal

    OK, maybe?

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    07-26-2012
    Location
    _
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: ► Message Box Error when Adjacent Cells Equal

    Sorry if I still wasn't clear, but I suppose that didn't matter because you still got it to work!
    Works great and definitely will give out repuptation points, plus thanks again for asking questions (responding) and helping! I will mark this thread as solved.

+ 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