Solved

Cells unlocked then locked when worksheet activated

Posted on 2013-12-02
5
266 Views
Last Modified: 2013-12-02
Folks,
In the attached workbook are two worksheets:
MonthlyTodayFindBirthdays
Sheet2
In the worksheet labeled "MonthlyTodayFindBirthdays" range L3:M14 and cell O2 are not locked.
When I protect the worksheet "MonthlyTodayFindBirthdays" I protect the worksheet as follows:
"Checked Select unlocked cells"
"Checked Format cells"
and then password protect the worksheet (password is 123memphis)
After protecting the worksheet I select the cells protected and unprotected and everything works fine. I have not left the worksheet.
However, when I select "sheet2" and return and activate "MonthlyTodayFindBirthdays" cells L3:M14 and O2 are now locked.
In looking at the Worksheeet.Activate I need to do some housekeeping in the "Practice" section. Maybe that's what's causing my cells to go from unlocked to locked?
Locked-cells.xlsm
0
Comment
Question by:Frank Freese
  • 3
  • 2
5 Comments
 
LVL 12

Assisted Solution

by:Harry Lee
Harry Lee earned 500 total points
ID: 39691188
fh_freese,

What cause your sheet to relock itself is

Worksheets("MonthTodayFindBirthdays").Range("L3:M14").Clear

Open in new window


Clear will clear all the formats, including the toggle of Locked and Unlocked.

Is there any reason for you to clear the cells, then set the format up again?

If not, why don't you use
Worksheets("MonthTodayFindBirthdays").Range("L3:M14").ClearContents

Open in new window

so that the content is removed but the format remains?
0
 
LVL 12

Accepted Solution

by:
Harry Lee earned 500 total points
ID: 39691234
If you really need to clear the cells then reestablish all the formats and borders, add the following to the end of your code.

Worksheets("MonthTodayFindBirthdays").Unprotect password:="123memphis"
Worksheets("MonthTodayFindBirthdays").Range("L3:M14").Locked = False
Worksheets("MonthTodayFindBirthdays").Protect password:="123memphis"

Open in new window

0
 

Author Comment

by:Frank Freese
ID: 39691257
Harry,
The reason for clearing the data in the range where the user can practice is that if I don't and they return to the Main Menu, the information they were working on is still there. When they return to the worksheet I want the worksheet to be "clean" - does this make sense to you?
I see what you are doing and the same thing crossed my mind. I just did not know it was possible.
I'll play around with it tonight after I get home and get back with you.
Thanks for the explanation - I did not know that about Clear but it makes sense now.
Frank
0
 

Author Closing Comment

by:Frank Freese
ID: 39691412
thanks...I "think" I've got it, but not sure yet how to implement your suggestion. I'll repost if I need more help
Appreciate it!
0
 
LVL 12

Expert Comment

by:Harry Lee
ID: 39691442
Anytime.

I'm glad I can help!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delete all words in cell more than 5 words 7 47
VBA macro broke in Excel 2016 in windows 10 5 63
Cascading dropdown 9 27
ADD New Entries 7 16
Drop Down List with Unique/Distinct Values (enhancing the Combo-Box with a few steps and a little code) David miller (dlmille) Intro Have you ever created a data validation list from a database field or spreadsheet column (e.g., Zip Codes or Co…
Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now