+ Reply to Thread
Results 1 to 2 of 2

Code not unlocking cells as it should be

  1. #1
    Registered User
    Join Date
    06-11-2007
    Posts
    46

    Code not unlocking cells as it should be

    Hi, I have a big block of data in a sheet. I want that block and only that block protected. It saved as locked, and protected. I have a macro that uses the data, and in the code I stipulate that it first unprotect the sheet and unlock ALL the cells in the worksheet (in case some other user had for some reason put a lock on unused cells. The macro does what it has to do, and at the end selects the range of used cells, and locks them and protects them.

    I tested this by choosing a blank cell and locking it, then running the code. Theoretically, when the entire cell range is selected and unlocked, this cell should be unlocked as well. Then, at the end of the macro, when the data block is selected, and locked, and protected, the blank cell that had been locked and protected before should be unlocked. I ran the macro, and tried to type in the blank cell, and it wouldn't let me. For some reason it stayed locked at the end of the code. Anyone know why?

    Here's what I have at the beginning of the code to unlock and unprotect:
    Please Login or Register  to view this content.
    And at the end to lock the cells I want and protect them:
    Please Login or Register  to view this content.
    I'll refrain from posting the entire code because it's kind of long

  2. #2
    Registered User
    Join Date
    06-11-2007
    Posts
    46
    So, I just tried another test. I unlocked a cell in the data range, and ran the macro. The cell ended up unlocked at the end, which should not be the case. Anyone see what's wrong with the code: a) why it doesn't unlock all the cells at the beginning and b) why it doesn't lock the cells it is supposed to at the end? It applied the unprotect and protect fine, I think the problem might just be with the locking and unlocking.

+ 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