Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default unlock last set of rows

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?

  #2   Report Post  
Posted to microsoft.public.excel.programming
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?


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unlock VBE Brettjg Excel Discussion (Misc queries) 3 October 16th 07 04:45 PM
How to Unlock K New Users to Excel 4 February 2nd 07 09:45 PM
unlock hidden rows when 'unhide' is greyed out? xela Excel Worksheet Functions 1 February 21st 06 02:16 AM
how do i password protect an .xls file? how do i unlock it for automation. e.g. want to unlock and access a .xls from another .xls macro. Daniel Excel Worksheet Functions 1 June 24th 05 02:59 PM
Unlock sheet PaulSin[_3_] Excel Programming 3 June 22nd 04 05:11 PM


All times are GMT +1. The time now is 08:29 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"