Solved

Prevent any cells being selected

Posted on 2014-02-05
2
226 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

This collection of functions covers all the normal rounding methods of just about any numeric value.
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

679 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