Solved

Cells unlocked then locked when worksheet activated

Posted on 2013-12-02
5
276 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 AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

809 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