View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.newusers
Jim Cone[_2_] Jim Cone[_2_] is offline
external usenet poster
 
Posts: 1,549
Default Sheet Protection

Mark,

Please avoid the use of the term "does not work / doesn't work".
Think of it as telling your auto mechanic "my car doesn't work".

That said...
What may be the problem is the shortcut keys are case sensitive.
So to use Ctrl + D, I have to press Ctrl + Shift + D.

I already covered the placement of the protect/unprotect code lines.
They have to go in both the Delete and Insert subs.
'---
Jim Cone
Portland, Oregon USA
http://excelusergroup.org/media/
(Formats & Styles xl add-in: lists/removes unused styles & number formats) - free




"Mark Wolf"
wrote in
message ...
Thank you gentlemen,
Jim, you are correct, that's exactly what happens but I tried to
modify VBA and it does not work. Here is the code:

Sub MacroDelete() 'Ctrl-D

Selection.EntireRow.Delete
ActiveSheet.PageSetup.PrintArea = "$A$1:$J$78"
End Sub

Sub MacroInsert() 'Ctrl-I
If ActiveSheet.Name = "Sick Sheet" Or ActiveSheet.Name = "Excused
Sheet" Then
Selection.EntireRow.Insert
'If ActiveSheet.Name = "Sick Sheet" Then
ActiveSheet.PageSetup.PrintArea = "$A$1:$J$78"
'Else ActiveSheet.PageSetup.PrintArea = "$A$1:$J$78"
End If
End Sub


Sub PrintEntire() 'Ctrl-Q
activeSheetName = Application.ActiveSheet.Name
Sheets(Array("Sick Sheet", "Excused Sheet")).PrintOut
Sheets(activeSheetName).Select
End Sub

This code is in the Module1

Thanks for your help
Mark