+ Reply to Thread
Results 1 to 5 of 5

Creating Password Function in Code

  1. #1
    Registered User
    Join Date
    08-27-2018
    Location
    London
    MS-Off Ver
    office 2016
    Posts
    45

    Creating Password Function in Code

    Hello, say I have this data set Apple (123) Banana(456) Carrot (789) Mango (222) Peach(333) Berry

    I want to have a cell say C12 be a cell where any number can be entered but it locks if a correct number corresponding to a fruit is entered and displays that fruit name in C11. If 123 is entered in C12 the word Apple is shown in cell C11.

    How can i have it that ONLY C12 is locked after an entry corresponding to a fruit. If a number that does not match say 156 is entered in C12 nothing happens, C11 remains blank or just shows FALSE.

    D12, E12 and so on should remain unlocked until a correct value is entered.

    I had patched together a formula for testing the code for C11 (the formula will be the same for D11, E11 and so on) not sure if it is the best.

    =IF(C12=123,"Apple",IF(C12=456,"Banana",IF(C12=789,"Carrot",IF(C12=222,"Mango",IF(C12=333,"Peach",IF(C12=444,"Berry"))))))

    Basically I want no one to be able to change C12 after a matching value has been entered.

    Please and thank you

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,864

    Re: Creating Password Function in Code

    Format cells where user can change data as unlocked (in attachment A12:Z12).
    Protect your sheet - I used password excelforum.com
    In sheet code (right click on sheet tab and select "display code"):
    Please Login or Register  to view this content.
    PS. I used in row 11 simple function with one if only. Instead of nested ifs I'd recommend using VLOOKUP or similar solution, but it's a subject for separate thread
    Attached Files Attached Files
    Best Regards,

    Kaper

  3. #3
    Registered User
    Join Date
    08-27-2018
    Location
    London
    MS-Off Ver
    office 2016
    Posts
    45

    Re: Creating Password Function in Code

    thank you so much for taking the time to do this...this is the function i have been looking for.....additional question how do I repeat the function on a different row say A24 on the same sheet

  4. #4
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,864

    Re: Creating Password Function in Code

    If protected - unprotect your sheet.
    Format cells where user can change data as unlocked (so for instance three ranges A12:Z12, A24:Z24, A36:Z36 - change these ranges also in the code below).
    Protect your sheet
    In sheet code (right click on sheet tab and select "display code"):
    Please Login or Register  to view this content.

  5. #5
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,743

    Re: Creating Password Function in Code

    Rule 08: Cross-posting Without Telling Us

    Your post does not comply with Rule 8 of our Forum RULES. Do not cross-post your question on multiple forums without telling us about your threads on other forums.

    Post a link to any other forums where you have asked the same question. If you have fewer than 10 posts here, you will not be able to post a link, but you must still tell us where else you have asked the question.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

    If you have less than 10 posts, do not try to copy and paste the link. Instead, type the link out in your thread.

    No further help to be offered, please, until the OP has complied with this request.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

+ 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. [SOLVED] Password code designed for 5 Users - NAVIGATION Help Needed! - CODE Issue!
    By JJFletcher in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 11-09-2014, 10:46 AM
  2. [SOLVED] VBA code in existing code to open when workbook encrypt with password.
    By deo_y in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-26-2014, 07:08 AM
  3. VBA code that bypass Password prompt for every workbook with one master password
    By pwnyadav007 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-22-2014, 01:45 AM
  4. creating a password
    By martindwilson in forum The Water Cooler
    Replies: 4
    Last Post: 03-07-2014, 02:11 AM
  5. Password removal via VBA (as defined in the code with password)
    By galvinpaddy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-22-2013, 07:35 AM
  6. Can't pass password through code, keeps prompting for password
    By Alexander40 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-20-2012, 03:55 PM
  7. [SOLVED] Creating a password form
    By Andrew in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-04-2005, 09:06 PM

Tags for this Thread

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