![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: May 2002
Posts: 251
|
Hi,
I want to Protect some area of the sheet. For example for Column B, I want to protect rows from 15 throught 25. like B15, throught B25, I want to set password for that. Is there anyway that you can do this? Thanks |
|
|
|
|
|
#2 |
|
Legend
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
|
Yep. Select all of the cells, go to format, cells, protection and uncheck the locked box.
Highlight a range, then go to format, cells, protection and check the locked box. Go to tools, protection, protect sheet. Check your options and enter the password (it is case sensitive). |
|
|
|
|
|
#3 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
Put the following in the declarations for your worksheet:
Private Sub Worksheet_SelectionChange(ByVal Target As Range) Dim ColNum As String, RowStart As String, RowEnd As String Dim SelCol As String, SelRow As String ColNum = "$B$" RowStart = "15" RowEnd = "25" SelCol = Left(Target.Address, 3) SelRow = Right(Target.Address, 2) If SelCol = ColNum And Application.WorksheetFunction.And( _ SelRow >= RowStart, SelRow <= RowEnd) Then pwrd = InputBox("Enter Password to unlock cells") GoTo 1 End If Exit Sub 1 If pwrd <> "password" Then MsgBox "Wrong password" [a1].Select End If End Sub Probably not what you exactly want, but this can be customized to fit your needs. Tell me what you think. The good thing with this code is that the password input box pops up as you try to enter into the cells. _________________ Hope this helps. Kind regards, Al. [ This Message was edited by: Al Chara on 2002-05-14 12:01 ] |
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Mar 2002
Location: Michigan USA
Posts: 11,452
|
Just to elaborate on the strategy that Nate has provided. I am sure Nate is not going to mind my jumping into it.
Nate has provided you the way to password protect cells B15:B25. However, keep in mind that the password protection applies to the entire sheet, and the way the password applies specifically to the cells B15:B25 is because those are the only cells that have been locked. Hope This Helps Regards! |
|
|
|
|
|
#5 |
|
Board Regular
Join Date: May 2002
Posts: 251
|
Thanks a lot man.
|
|
|
|
|
|
#6 |
|
Board Regular
Join Date: May 2002
Posts: 251
|
Oh its great with password box. I like it so much.
Thanks, you are the great. |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|