Solved

Prevent any cells being selected

Posted on 2014-02-05
2
225 Views
Last Modified: 2014-02-09
Hi

I noticed in vba within the sheets properties is a function which prevents any cells being selected if the sheet is locked, how can I enable this with a vba command?
0
Comment
Question by:DemonForce
2 Comments
 
LVL 81

Accepted Solution

by:
byundt earned 500 total points
ID: 39837898
The setting in the Properties for the worksheet doesn't accomplish anything until the worksheet is protected, as you have discovered.

In VBA, you would want to protect the worksheet first, then make the setting to prevent cell selection.
Sub NoSelection()
With Worksheets("Sheet1")
    .Protect
    .EnableSelection = xlNoSelection
End With
End Sub

Open in new window

0
 
LVL 29

Expert Comment

by:gowflow
ID: 39838274
@byundt thumbs up !!! nice one I didn't know about it very handy.
gowflow
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

831 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