Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

noob question with line/field protection

Status
Not open for further replies.

kaeptn

Programmer
Apr 4, 2006
1
DE
Hi,
i want to protect just one line in the whole sheet.
But it's not working :-(
Can anybody give my a hint what i'm doing wrong ?

Here is the code i wrote:

Sheets("tabelle1").Activate
Cells.Select
Selection.Locked = False
Range(A1, Z1).Locked = True
Sheets("tabelle1").Protect Password:="test", contents:=True

Thanks !
 
Try
Code:
Range("A1").EntireRow.Locked = True


Regards,
Mike
 

Hi,

Problem's in your Range statement...
Code:
    With Sheets("tabelle1")
        .Cells.Locked = False
        .Range([A1], [Z1]).Locked = True
        .Protect Password:="test", contents:=True
    End With

Skip,

[glasses] [red]Be Advised![/red] A chicken, who would drag a wagon across the road for 2 cents, is…
POULTRY in motion to PULLET for a PALTRY amount! [tongue]
 
Replace this:
Range(A1, Z1).Locked = True
with this:
Range("A1:Z1").Locked = True

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top