Locking cells

halcyoneus

Board Regular
Joined
Mar 26, 2003
Messages
147
Well, I want to do more then just lock cells....

I have a little program whipped up in ecxel and I don't want anyone to be able to modify any cells except cells A1 or A2. I've been able to do this using the Validation function in Excel, but want to go 1 step further. I don't even want anyone to be able to select any other cells. If they do, I want the selection to automatically select either A1 or A2.

Anyone have any ideas to help?

~Hal
 
wow its like it isnt saving your workbook then cuase it should save the VBA code.

You have this then;

Code:
Private Sub Worksheet_Activate()
    ActiveSheet.ScrollArea = "A1:B1"
End Sub
 
Upvote 0

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Yes,
That's what I have. Actually, the code doesn't do anything at all. It only works when I go to the specific sheet properties under scroll area and add the cells.
 
Upvote 0
WOW,
If I put the code in one of the other sheets, it works in that sheet and on the sheet I'm originally working with. If I take the code off the other sheet, my original sheet doesn't work anymore.

~Hal
 
Upvote 0
Do it the easy way, just put this into the Sheet Module and remove all the other protection:


Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Not (Target.Address = "$A$1" Or Target.Address = "$A$2") Then ActiveSheet.Range("A1").Select
End Sub


It will only let the user select A1 & A2 all other selections will take the user to A1.
 
Upvote 0

Forum statistics

Threads
1,215,943
Messages
6,127,826
Members
449,411
Latest member
adunn_23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top