+ Reply to Thread
Results 1 to 16 of 16

How to protect cells after one user input?

  1. #1
    Registered User
    Join Date
    05-02-2007
    Posts
    9

    Cool How to protect cells after one user input?

    Hi folks!

    I want to administrate a short training test. The user has chooses a correct answer A-E, off a drop down menu. I want to set it up so the user can't answer multiple times until they choose the correct answer.

    Any ideas, thanks!

    -Ed Chan

  2. #2
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    There might be a simpler method for this, but here is one way. Right-click the sheet tab, select view code, and copy this procedure:
    Please Login or Register  to view this content.
    You can use this for any number of cells, by copying the green font above and pasting it. As you can see, I have it set up to work for data validation lists in cells B1 and C1. Just change to suit your needs.

    Let me know if this doesn't make sense, or if it doesn't accomplish what you are looking for.

    Jason

  3. #3
    Registered User
    Join Date
    05-02-2007
    Posts
    9

    Smile How to set the range?

    Hi Jason!

    Thanks for your help!!!

    I couldn't get it to work, you can stil go back and change the answers. All of the answers are in column B, so I figured if I could set the range to B1:B103 it would work, but it doesn't appear to.

    In the Microsoft Visual Basic mode, do I leave the right hand drop down to "Change"?

    -Ed Chan

  4. #4
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Hi, Ed. Did you copy the entire code that I posted above? After you paste it, there should be nothing on the screen other than that code. If upon entering VBA by right-clicking the sheet tab, a Worksheet_SelectionChange event is automatically created, delete it before copying the code I posted. Let me know whether that works or not.

    Jason

  5. #5
    Registered User
    Join Date
    05-02-2007
    Posts
    9

    RE: VBA code

    I did try copying the entire code, it didn't work. Not sure what I'm doing wrong, I can still edit the data multiple times.

    -Ed

  6. #6
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Hi again, Ed. If your data isn't confidential, can you post up a copy of the zipped file so I can take a look at it?

    Jason

  7. #7
    Registered User
    Join Date
    05-02-2007
    Posts
    9

    Copy of spreadsheet

    Hi Jason!

    Attached is one of the spreadsheets, thanks mucho for your assistance!

    -Ed
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Hi, Ed. It looks like there are 2 issues. First, you did not change the ranges for your questions. It still showed B1, but the answers are in column E. What I did was selected all of the cells for answers, and named the range as "Answers". Then I changed Range("B1") to Range("Answers") to use the correct range.

    Second, unfortunately, it looks like if you use a list with data validation, it does not call the worksheet change event handler procedure. However, if you manually enter the selections (rather than using ranges), it works. Not sure why that is. I entered this into the first answer for you to show you what I am talking about (check the validation I used on this cell).

    HTH

    Jason
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    05-02-2007
    Posts
    9

    Protecting answers

    Hi Jason!

    Thanks for taking the time to look at this. I understand what you're saying about the data validation, if I have to type it in manually that's fine.

    But it doesn't seem to work, you can modify the answer until you get it correct. Did it work for you?

    -Ed

  10. #10
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    This turned out to be a little more complicated than I first anticipated (isn't it usually?). I think I have most of the bugs worked out. One additional item was that you could not reset all answers to blanks, so I included a password feature that allows you to enter delete in the cells. See VBA code to change the password.

    Jason
    Attached Files Attached Files

  11. #11
    Registered User
    Join Date
    05-02-2007
    Posts
    9

    Test spreadsheet

    Hi Jason!

    It's still not working for me, did it work for you?

    -Ed

    By the way, if we can get this working, I would like to compensate you for your time on this.

  12. #12
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Hmmm, that is odd. It works just fine for me. I tried it on both Excel 97 and 2003, and it works on both. What exactly is it doing for you?

  13. #13
    Registered User
    Join Date
    05-02-2007
    Posts
    9

    Loan Officer spreadsheet

    It isn't preventing me from changing the answer, you can modify the answer until you pick the correct one.

    -Ed

  14. #14
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    I assume you have macros enabled? The settings need to be either on medium or low to run.

    Once you select an answer from the drop-down, does the cursor move down to the next row, or does it stay on the answer?

  15. #15
    Registered User
    Join Date
    05-02-2007
    Posts
    9

    It works!!

    Cool, it works, thanks!

    Please contact me at ed@myfamg.com, I really appreciate your help!

    -Ed

  16. #16
    Registered User
    Join Date
    05-02-2007
    Posts
    9

    Red face Copying code to other spreadsheets

    Hi Jason!

    I've been trying to copy the code to the 7 other tests, and have been getting run time errors.

    If you wouldn't mind, can you assist me in copying the code to other spreadsheets?

    Thanks for all your help and hard work,

    -Ed

+ 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