Solved

Protection of particular Elements in Excel

Posted on 2014-09-10
4
74 Views
Last Modified: 2014-09-29
Hi Experts,

I'm trying to unprotect then protect a worksheet in Excel.

The elements that I would like the users to be able to use are:

Select unlocked items
Edit Objects

The reason being that I have a form that opens when the user double clicks in a range and if I simply turn protection on they are unable to trigger the action to fire the open of the form (the double click).

One part of the code currently looks like this:

Dim myPassword As String
myPassword = "GHDORF"
Application.ScreenUpdating = False
If Range("OTHERACTIVITY").Value = True Then
'UnprotectSheet
Worksheets("ORF - Activities").Unprotect Password:=myPassword

I can't seem to work out how I set the property/elements as described above.

Any help would be awesome!

Thanks

Martywal
0
Comment
Question by:martywal
  • 2
4 Comments
 
LVL 45

Accepted Solution

by:
Martin Liss earned 500 total points
Comment Utility
I'm not sure I understand what you want to do but did you select the 'Select unlocked items' and 'Edit Objects' options when you protected the sheet and prior to that did you go to Format Cels|Protection and deselect the 'Locked' checkbox for the range you want the user to be able to double-click?
0
 

Author Comment

by:martywal
Comment Utility
Hi There.
The cells in the range are already locked.
The issue is that when I add protection to the sheet manually I can actually chose what elements I can protect on the worksheet.

When one of my scripts is run, in this case a double click of the mouse (within a certain range it fires a module that opens a form) the sheet is unprotected then protected at the end of running the module BUT not with the same elements available/unavailable to the user.

I'm now trying to replicate the issue and may have solved it... Can't reproduce the problem today. Very strange. I'll be back soon.

Thanks for comments!
0
 

Author Comment

by:martywal
Comment Utility
Sorry not to have closed this sooner...
I have found that if I set the properties when I add protection to a sheet it holds the same as VB turns protection on and off.
Thanks for submissions
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
We were having a lot of "Heartbeat Alerts" in our SCOM environment, now "Heartbeat" in a SCOM environment for those of you who might not be familiar with SCOM is a packet of data sent from the agent to the management server on a regular basis, basic…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

763 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

6 Experts available now in Live!

Get 1:1 Help Now