ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Deny/Allow for certain range. (https://www.excelbanter.com/excel-discussion-misc-queries/205085-deny-allow-certain-range.html)

dan

Deny/Allow for certain range.
 
Hello everyone,

I have a question and I hope to get an answer. I use a Excel spreadsheet and
I need to set it up the way that only specific range in the sheet can be used
as an active. There is range such as B1:C20, so whenever mouse is being
clicked out of that range it should not select any other cell, except for
those in the specified range. How can that be accomplished?

Bill Kuunders

Deny/Allow for certain range.
 
one way


enter the code below into the worksheet selection change
note ..........top and bottom lines are already there

method to get there

right click onto the sheet tab
select view code
select worksheet in the dropdown box which shows "general"
select selectionchange in the righthand dropdown box

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Action_Range As Range
Set Action_Range = Range("B1:C20")

Dim Current_Range As Range
Set Current_Range = ActiveCell


If Intersect(Current_Range, Action_Range) Is Nothing Then

Range("B1").Select
Beep
MsgBox "You need to select within B1 to C20", vbInformation

End If
End Sub

--
Greetings from New Zealand

"Dan" wrote in message
...
Hello everyone,

I have a question and I hope to get an answer. I use a Excel spreadsheet
and
I need to set it up the way that only specific range in the sheet can be
used
as an active. There is range such as B1:C20, so whenever mouse is being
clicked out of that range it should not select any other cell, except for
those in the specified range. How can that be accomplished?




T. Valko

Deny/Allow for certain range.
 
You can do this by applying sheet protection

Select the *entire* sheet by clicking the little square immediately to the
left of column A and immediately above row 1.

Goto the menu FormatCellsProtection tabLockedOK
Select the range of cells that you want to allow access to B1:C20
Goto the menu FormatCellsProtection tabuncheck LockedOK
Now, set the sheet protection:
Goto the menu ToolsProtectionProtect sheet
You'll see various options available to you. Since you don't want users to
be able to select cells outside of the range B1:C20 uuncheck the option:
Select locked cells and check the option: Select unlocked cells

OK out

--
Biff
Microsoft Excel MVP


"Dan" wrote in message
...
Hello everyone,

I have a question and I hope to get an answer. I use a Excel spreadsheet
and
I need to set it up the way that only specific range in the sheet can be
used
as an active. There is range such as B1:C20, so whenever mouse is being
clicked out of that range it should not select any other cell, except for
those in the specified range. How can that be accomplished?





All times are GMT +1. The time now is 04:45 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com