Solved

Prevent any cells being selected

Posted on 2014-02-05
2
231 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 31

Expert Comment

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

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

635 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