+ Reply to Thread
Results 1 to 2 of 2

Auto lock cells with a range that includes merged cells.

  1. #1
    Registered User
    Join Date
    08-12-2014
    Location
    UAE
    MS-Off Ver
    7
    Posts
    10

    Auto lock cells with a range that includes merged cells.

    Hi All,

    I have learned that using merged cells is not a good idea with excel. But, my workbook has grown too big to undo the merged cells. I have a protected workbook with some cells locked, some unlocked. I want the unlocked cells to lock once data has been entered. When I use the following code on the un-merged cells, it works fine:

    Please Login or Register  to view this content.
    But If I make the range include merged cells (B5:G100), ie Range("A5:O100"), then it fails.

    I saw in another thread someone locking merged cells for someone else probelm using this:

    First check if the cell is merged, such as:
    If cell.MergeCells = True

    If it is, set a range object to the merged range, such as:
    Set mergedRange = cell.MergeArea

    Then simply set the locked status of the merged range object, such as:
    mergedRange.Locked = True


    Is there someone that could edit my code to combine the merged cell check?

    Thanks
    Last edited by garyreid81; 12-20-2014 at 10:55 AM.

  2. #2
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Auto lock cells with a range that includes merged cells.

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

+ 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: 0
    Last Post: 11-25-2014, 07:08 AM
  2. [SOLVED] Merged cells lock after resizing
    By wvvvdracovvvw in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-17-2014, 11:47 PM
  3. [SOLVED] Auto insert blank row. (blank copy of row that includes merged cells)
    By rutts in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-22-2013, 07:48 PM
  4. [SOLVED] Counting Cells that includes exact match and also if a cell includes specific text
    By smclachlan in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-19-2012, 07:42 PM
  5. Error: Cannot change the part of merged cell - When trying to lock cells in range
    By Ranjani in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-09-2009, 12:03 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