Thread: Cell protection
View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Scoops Scoops is offline
external usenet poster
 
Posts: 108
Default Cell protection


Gregg Johnson wrote:
Wow - that works great. Thanks.

Glad to help, just be aware that the macro will work on every cell in
the worksheet so, if you do have some cells that you would like to be
altered by a paste action, you'll need to restrict where the macro
works.

For example, if you do not want it to affect cells in column A or row 2
or cell B3 then something like:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim myValue
If Target.Column = 1 Or _
Target.Row = 2 Or _
Target.Address = "$B$3" Then Exit Sub
With Application
.EnableEvents = False
myValue = Target.Value
.Undo
Target = myValue
.EnableEvents = True
End With
End Sub

Regards

Steve