0% found this document useful (0 votes)
35 views1 page

Excel VBA: Protect Sheet with Exceptions

The provided VBA macro unlocks specific ranges in the 'Duct Weight Calculator' worksheet while locking all other cells. It unlocks rows 2-1000 in columns A to E and the range M2 to M6. Finally, it protects the worksheet with the password 'Naira', allowing filtering and sorting functionalities.

Uploaded by

hwen.hh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views1 page

Excel VBA: Protect Sheet with Exceptions

The provided VBA macro unlocks specific ranges in the 'Duct Weight Calculator' worksheet while locking all other cells. It unlocks rows 2-1000 in columns A to E and the range M2 to M6. Finally, it protects the worksheet with the password 'Naira', allowing filtering and sorting functionalities.

Uploaded by

hwen.hh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

Sub LockSheetExceptInput()

Dim ws As Worksheet
Set ws = [Link]("Duct Weight Calculator")

[Link] "Naira"
[Link] = True

[Link]("A2:E1000").Locked = False ' Always unlock rows 2-1000 in columns


A:E
[Link]("M2:M6").Locked = False

[Link] Password:="Naira", AllowFiltering:=True, AllowSorting:=True,


UserInterfaceOnly:=True
End Sub

You might also like