View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jürgen Jürgen is offline
external usenet poster
 
Posts: 1
Default Avoid user to access first two rows in a sheet

To protect the contents of the 2 first rows of an excel sheet, so that
the user cannot change them, I wrote the following code:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Row <= 2 Then Cells(3, 1).Select
End Sub

When the user selects a cell or a range which overlaps one of the
first two rows the cell A3 is selected and thus the user cannot change
the contents of the first two rows, I thought :o(

Even with this code the user can change the contents by a double-click
on the header of row 1 or 2 or on a column header.

The code I wrote for this was build up of more than one line in the
beginning, so I thought that a double-click was fast enough to be
interpreted between two lines of the code, but even with this single
line it doesn't work.

I also tried to add Application.Interactive = False but it doesn't
change anything.

All suggestions are welcome!