Results 1 to 2 of 2

VBA Lock and protect cells

Threaded View

  1. #1
    Forum Contributor
    Join Date
    11-08-2012
    Location
    Manchester, UK
    MS-Off Ver
    Excel 2016
    Posts
    144

    VBA Lock and protect cells

    Hello,

    I will try and explain this the bext I can.
    The attached sheet is an example sheet of what I am trying to do.
    All cells are 'Locked' and 'Hidden' with the exception of W3:X45.

    I have a VBA script that, when I save the document, it looks at the cells W3:X45, adds the 'Locked' atribute to the non-empty cells and then protects the sheet. This bit is working but it is also unlocking all the empty cells.

    I want to leave all the other cells 'Locked', protected and untouched, I only want the VBA script to work on the section of W3:X45; locking the cells that containing something.

    I have tried a few varitions of the script but I am no expert at VBA so decided to go to those that are :-)

    Instead of adding all my code attempts to this I have added them all to the VBA Script editor for you to look at and compare.


    Thank you all in advance.
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Lock/protect cells after value entered
    By WillJansen in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-13-2016, 06:04 PM
  2. lock and protect all but certain cells
    By JediMaster in forum Excel General
    Replies: 5
    Last Post: 08-20-2010, 09:52 AM
  3. pROTECT OR lOCK CELLS SO THAT THEY CANNOT BE EDITED
    By facmess1 in forum Excel General
    Replies: 1
    Last Post: 05-31-2007, 05:26 PM
  4. Lock/Protect cells so they cant get overwritten
    By Mayhs in forum Excel General
    Replies: 3
    Last Post: 04-11-2007, 02:16 PM
  5. Can I protect/lock only the cells containing formulas?
    By JLee98 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-18-2007, 10:17 PM
  6. Protect/Lock Specific Cells
    By srf1030 in forum Excel General
    Replies: 6
    Last Post: 07-06-2005, 04:05 PM
  7. [SOLVED] Can I use the grouping and lock and protect cells
    By bfisher in forum Excel General
    Replies: 1
    Last Post: 01-11-2005, 07: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