Protect Cells in Excel by Locking Scrollbar

We all know that for some problems, Protect Sheet tool under the REVIEW tab doesn’t cut it. Well, Jordan has found another way to restrict end-user access and it has its own advantages.

Let’s get to it.

1 – The Basics – Restricting Users

The way this technique works is by restricting users to a specific range within a sheet by limiting ‘Scroll Area’. For example, follow these steps:

  1. Make sure DEVELOPER tab is enabled.
  2. Go under this tab and click on Properties from the Controls section.
  3. Now type in the array you want to restrict users to in the ‘ScrollArea’ section and press Enter.

For illustration, we will be locking in “A1:K20” (see the image below). Now users cannot scroll down, neither can they click on any cell outside this range. Note that any contiguous range can be selected instead of “A1:K20”.

1

Benefits include getting rid of the need to unlock cells and enable sheet protection. Also, some features that are disabled by sheet protection would available here. The only problem is that the lock on scroll area disappears when you reopen the file. But we have a solution to this problem as well.

2 – Making it Stick Using VBA

Click on DEVELOPER > Visual Basic and then paste the following code in “ThisWorkbook”:

2

Note that “A1:K20” is just an example array. You can type in any other array as long as it is contiguous.

For people unfamiliar with event-driven programming in VBA: when you open a workbook, Excel calls it by event name “Workbook_Open”. And whatever code is written under this event name gets executed without the user asking for it. Hence, upon opening your Excel file, Sheet1 will always get a scroll lock on “A1:K20”. Other such events include “Worksheet_Activate”, “Worksheet_Deactivate” and “Workbook_Deactivate”.

3 – When To Use This Technique

This technique of restricting user access is useful in the following cases:

  • To keep the users in one area of the screen.
  • To design simple interfaces with contiguous array of cells.
  • To protect specific columns of an input table.

The last case can also be dealt with through the use of ‘One Click UserForm’, a popular product to enable safe data entry.

4 – Problems That You May Have

The only problem now is that if your array is discontinuous, you cannot use this method. Of course, you can always resort to the classical sheet protection method in this case.

What’s next?

Start tapping away at your keyboard and try this technique out ASAP! I am sure you can put it to some amazing use in your own work.

Do not forget to share this cool trick with your colleagues. And write your thoughts to us in the comments section below.

Jamani Arsalan

Tags


You may also like

April 9, 2011

How to Create a Rollover Effect in Excel: Execute a Macro When Your Mouse is over a Cell

October 26, 2014

Monte Carlo Simulation Formula in Excel – Tutorial and Download

September 17, 2012

The Excel Rollover Mini FAQ
{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

Free 24 Excel Tips Guide

Discover the secrets to Excel efficiency with our free guide: '24 Proven Microsoft Excel Tips to Help You Save Time'

A humble gift from us to you, to make your Excel journey smoother and more productive. Grab your copy now and start mastering Excel like never before!

>