Consulting

Results 1 to 5 of 5

Thread: Solved: Is it possible to protect specific cells on the sheets,

  1. #1

    Question Solved: Is it possible to protect specific cells on the sheets,

    Is it possible to protect specific cells on the sheets, not sheets only specific cells.

  2. #2
    VBAX Tutor
    Joined
    Feb 2008
    Location
    New York
    Posts
    215
    Location
    -u

  3. #3
    I tried the way that in this link:
    - Select All cells on the worksheet (Ctrl-A)
    - Go into Format Cells (Ctrl-1)
    - Go to the Protection Tab
    - Ensure that "Locked" is unticked( not selected)
    - Click OK

    - Select Collumns A-C (Ctrl-Space) to select a collumn, (Shift-RightArrow) to drag
    - Go into Format Cells
    - Lock these cells
    - OK

    - Tools, Protection, Protect Sheet
    This will only protect the locked cells


    it protected the specific cells, but it canceled the format properties for the unprotect cells. Is there another way to protect and keep the format.

  4. #4
    VBAX Expert
    Joined
    Feb 2005
    Location
    Nanaimo, British Columbia, Cananda
    Posts
    568
    Location
    Hi Nader,

    This has been around a while (I wish I knew who wrote it...)

    Anyways, I adapted it to check a User entered array of cells and 'protect' only those cells.

    There is code in the Sheet module as well as in the standard modules. It's in the Standard module (Module1) that you must enter your cells addresses.

    Look in the Sub ''UndoZero" for these lines:

    [vba]

    ' Enter the addresses of the cells to be 'protected'

    ' Be sure to format as in example

    '//BEGIN USER CHANGE

    CellRng = Array("$A$1", "$B$1", "$C$2")

    '//END USER CHANGE

    [/vba]

    and enter your cell addresses as per the example.

    Change the two msgboxes to suit. One for the cell protection and a second for erroring out (though I've not seen this code error out ...yet...)
    Cheers,

    dr

    "Questions, help and advice for free, small projects by donation. large projects by quote"

    http:\\www.ExcelVBA.joellerabu.com

  5. #5
    Thank you for help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •