View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default unlock last set of rows

You unprotect worksheet, not cells.

wksDisplayResults.Unprotect Password:="ABCD"
wksDisplayResults.Cells(Rows.Count, 1).End(xlUp _
).Offset(1, 0).EntireRow.Locked = False
wksDisplayResults.protect Password:="ABCD"


--
Regards,
Tom Ogilvy

"RigasMinho" wrote:

Is there a way to unlock the last row in a worksheet?

I have a data sheet that has columns A-E filled with information. It
is locked and protected by excel.

But say i want the user to be able to unlock the last row say its 50.

So start from row 50 they can unlock it.

I figured the code would have to be placed in the before change of the
worksheet or whenever they activate the worksheet.

Private Sub Worksheet_Activate()
Dim ri As Long ' Row Index used to know which row results should
paste into
Dim wksDisplayResults As Worksheet ' Output sheet
Set wksDisplayResults = Worksheets(Sheet10.Name)
ri = wksDisplayResults.Cells(Rows.Count, 1).End(xlUp).Offset(1,
0).Select
End Sub

this finds the last cell but i cant get it so that it unlocks the last
row as well.
i thought
ri = wksDisplayResults.Cells(Rows.Count, 1).End(xlUp).Offset(1,
0).unprotect password:="mypassword"

would work but it doesnt.

any ideas?