+ Reply to Thread
Results 1 to 5 of 5

Lock or unlock cell in vba

  1. #1
    Forum Contributor
    Join Date
    09-28-2006
    Posts
    122

    Lock or unlock cell in vba

    i have a 2 particulary large sheets of data (something like 640 rows by 52 columns on each sheet) and need to protect the sheet so that the users cannot edit / alter any cells that contain formula's, however, they can edit any cells that do not contain formulas.

    there are far too many cells to manually check, lock or unlock and then protect the sheet.

    i know the cells can be locked or unlocked in vba using

    Cells(x, y).Locked = False
    however, i have no idea how to check every cell, deterin if it contains a formula (and lock it) or if it does not contain a formula (and unlock it), so i am looking for some advice on how to proceed.

    any help would be gratefully appreciated

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Maybe

    Please Login or Register  to view this content.
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Forum Contributor
    Join Date
    09-28-2006
    Posts
    122

    Thanks So Much

    Hi Noob,

    THANKS FOR THAT its perfect,

    i never dreamt that the code could be so simple as one line!

    is there a good book / helpfile that would give this information.

    once again,thanks, you saved me hours!!!!!!!!!!!

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Lots of good stuff on the below link.

    John Walkenbach books are good

    http://www.j-walk.com/ss/books/index.htm

    or you can pick up a second hand book called Microsoft Excel 97 Step by Step which is very good

    http://www.amazon.com/Microsoft-Exce.../dp/1572313145

    For this one i just record the following actions

    F5 > Special > Formulas then while selected right clicked and under protection tab selected locked

    this gave me

    Please Login or Register  to view this content.
    Then I change the first selection to cells. Can change to a range

    HTH

    VBA Noob

  5. #5
    Forum Contributor
    Join Date
    09-28-2006
    Posts
    122
    once again thanks, so much to learn, so many ways to improve.

+ 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