Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Tom,
A bit of tweaking with your code now it works. Private Sub Workbook_Open() Dim cell As Range Worksheets("Sheet1").Activate ActiveSheet.Unprotect Password:="abc" For Each cell In Rows(1).Cells If cell.Text < Format(Date, "dd/mm/yyyy") Then cell.EntireColumn.Locked = True Else cell.EntireColumn.Locked = False End If Next ActiveSheet.Protect Password:="abc" End Sub Thanks "Tom Ogilvy" wrote in message ... You need to understand protection. Cells are locked or unlocked - which is meaningless unless the sheet it protected. -- Regards, Tom Ogilvy "Shobhit Bhatnagar" wrote in message ... Thanks for your reply. I tried the code it does not work. What i am trying to achive is to protect the column based on the date value. The columns which are less than current system date should get protected. Through this code i tried to the whole sheet get protected. Thanks for the solution in advance. Shobhit Bhatnagar *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Locking column headers | Excel Discussion (Misc queries) | |||
Locking Formula - Whole Column | Excel Discussion (Misc queries) | |||
Locking a Column | Excel Discussion (Misc queries) | |||
Locking column entries to an adjacent linked column | Excel Discussion (Misc queries) | |||
Locking column | Excel Programming |