+ Reply to Thread
Results 1 to 6 of 6

auto generate a comment box based on a cell value that has variable reference cells

  1. #1
    Registered User
    Join Date
    01-08-2010
    Location
    Sussex County, Delaware
    MS-Off Ver
    Excel 2013
    Posts
    40

    auto generate a comment box based on a cell value that has variable reference cells

    I have been given the following code and it works great. I now need to adapt it to the following scenario:

    In the attached sheet, the user has to select either, "Suburban" or "Squad" in row 5.
    If the user selects, "Suburban" I need this script to compare the values they enter in a given row to the value in column "B".
    If the user selects, "Squad" I need this script to compare the values they enter in a given row to the value in column "C".

    Look at row 48, for example. If the user enters, "Suburban" in cell D5 then the value they enter in cell D48 should equal "1". If it does not equal "1" then it should proceed with the adding of a comment. Conversely, if the user enters, "Squad" in cell D5 then the value the enter in cell D48 should equal "2". If it does not equal "2" then it should proceed with the adding of a comment.

    WHEW! Clear as mud?

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by vamedic11; 01-31-2010 at 10:15 PM.

  2. #2
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: auto generate a comment box based on a cell value that has variable reference cel

    Have you moved this from the workbook to the sheet? It needs to be adjusted to fit the environment you put it in, do you want it to apply to all sheets (except DATA), or just this specific one?

    I'd also recommend you remove Modules a and 2 (your Auto_Open macro doesn't achieve anything!)

    CC

  3. #3
    Registered User
    Join Date
    01-08-2010
    Location
    Sussex County, Delaware
    MS-Off Ver
    Excel 2013
    Posts
    40

    Re: auto generate a comment box based on a cell value that has variable reference cel

    I had only included the one sheet in the last attachment, and did not think about it confusing/clouding the big picture. I have attached the whole book this time. The auto_open basically just puts everything back at the beginning each time someone opens the file.

    The code I had included in the original message was from another book and works fine for that application. I am just trying to convert it to the needs of this book. The revised code would be placed in the, "PRIMARY EQUIPMENT" and "RESERVE EQUIPMENT" sheets as the other sheets have different requirements.
    Last edited by teylyn; 01-31-2010 at 07:15 AM. Reason: quote removed

  4. #4
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: auto generate a comment box based on a cell value that has variable reference cel

    hmm... looking at your description, your check is based on two dependencies, so it must fire when the second is specified, and first check the first...

    like so: (replace the entire code for each of your two sheets)
    Please Login or Register  to view this content.
    hth

  5. #5
    Registered User
    Join Date
    01-08-2010
    Location
    Sussex County, Delaware
    MS-Off Ver
    Excel 2013
    Posts
    40

    Re: auto generate a comment box based on a cell value that has variable reference cel

    Curious. I get a runtime error saying the sheet is protected and I need to unprotect the sheet. I do have the sheet protected, but the cells are unlocked. It wasn't happening with the other code. I think I know why, but I don't know the language to fix it.

    I run this macro when I edit or save:

    Please Login or Register  to view this content.
    When I run the "protect" macro, it protects with the option, "select unlocked cells" enabled. What language do I need to add to this macro so that, "Edit objects" are also enabled?

  6. #6
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: auto generate a comment box based on a cell value that has variable reference cel

    How about this?

    Please Login or Register  to view this content.

+ 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