i need a page code

cyote101

Active Member
Joined
Dec 11, 2004
Messages
315
Hello i need a code to put in the page that will when i push the shift button on the keyboard it will unprotect the sheet but when i letgo of the sift button it will protect again.

when i push the shift button i also want it so i can only select specific cells
a1,a2,a3,a4,a5,a6,a7,b1,b2,b3,b4,b5,b6,b7 etc

i would also like it if i could include the following code

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target.Count > 1 Then Exit Sub
If Target.Row < 10 Then Exit Sub
If Target.Row > 28 Then Exit Sub
If Target.Row Mod 2 <> 0 Then Exit Sub
Application.ScreenUpdating = False
ActiveSheet.Unprotect
Cells(Target.Row, 4).Copy



Range("$D$4").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Application.ScreenUpdating = True

End Sub

thanks for your help
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
I do not know if what you want is entirely possible. If you want to detect a keypress at any time there has to be a continually-running macro - and this will prevent any normal interaction with the sheet. You might be able to add to the keypress detection to do what you want.

As a pointer, here is a link to the starter of a game which "moves" a cell selection around the screen depending on which arrow key is pressed.

With this sort of application the prevention of other inter-action is a bonus.

http://www.mrexcel.com/board2/viewtopic.php?t=110038&highlight=
 
Upvote 0

Forum statistics

Threads
1,222,737
Messages
6,167,903
Members
452,155
Latest member
Prakash K

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