+ Reply to Thread
Results 1 to 2 of 2

VBA Lock Row based on content in column

  1. #1
    Registered User
    Join Date
    03-21-2014
    Location
    Diss, Norfolk, England
    MS-Off Ver
    Microsoft 365 Excel
    Posts
    57

    VBA Lock Row based on content in column

    I've looked (with little success) for a Macro that is able to protect an entire row based on the value in Column B. For example, Column B is my index with unique values - some starting with the word "TEMP" as a prefix (e.g. TEMP1234). Those rows with cells in Column B that DO NOT have a prefix of "TEMP" must be kept unprotected so they are editable by a number of users, whereas rows where cells in Column B do not have that prefix of "TEMP" (always 6-digit numeric identifiers) must be protected (not necessarily with a password). I will run the VBA code on opening and closing the workbook and I am able to do that on my own.

    In summary, I want to lock/protect rows where cells in Column B have 6-digit numeric numbers and where the prefix "TEMP" is absent. Any quick code solution would be extremely helpful.
    Thank you again in advance.
    Last edited by Kausch; 10-05-2016 at 11:55 AM.

  2. #2
    Registered User
    Join Date
    03-21-2014
    Location
    Diss, Norfolk, England
    MS-Off Ver
    Microsoft 365 Excel
    Posts
    57

    Re: VBA Lock Row based on content in column

    OK, I've managed to resolve my own problem with the following code:
    In Module
    Please Login or Register  to view this content.
    In Sheet
    Please Login or Register  to view this content.
    HOWEVER
    The above code seems to protect everything (even when it finds blank cells in Column B) and only unprotect rows that have a prefix of "TEMP" in Column B. I really need it modifying so that it "unprotects everything" and only protects those items NOT using the prefix of "TEMP" in Column B. Also...
    ...I am working from a "Table" where one would press the <TAB> key on last cell to add a new row - the Protection seems to stop allowing me to add a new line!
    Can anyone advise please?
    Last edited by Kausch; 10-12-2016 at 04:01 AM.

+ 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. Replies: 8
    Last Post: 06-19-2016, 06:27 PM
  2. [SOLVED] VBA lock cells based on their content
    By Sinon05 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-30-2015, 10:29 AM
  3. Lock/unlock specific cells in a row based on another cell content of the same row
    By st_rod000 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-10-2014, 02:58 AM
  4. Replies: 5
    Last Post: 10-26-2011, 11:57 AM
  5. How to delete all content in a row based on a column's content
    By mccalljohn in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-01-2011, 12:05 AM
  6. Lock and clear cell content based on another cell's value
    By mohitmahajanin in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-23-2008, 06:30 AM
  7. [SOLVED] How do I lock a cell based on content of another cell?
    By Alan T in forum Excel General
    Replies: 3
    Last Post: 10-23-2006, 08:57 AM

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