View Single Post
 
Old 10-29-2012, 01:07 AM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You can do this with a 'Worksheet_Change' macro in the relevant worksheet module.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, ActiveSheet.Range("B:B")) Is Nothing Then Exit Sub
ActiveSheet.Unprotect
If IsDate(Target.Value) Then Target.Locked = True
ActiveSheet.Protect
End Sub
To use the macro, first format all cells as neither locked nor hidden. Then apply worksheet protection. The macro above assumes no protection password.

To install the macro, press Alt-F11 to open the vb editor, then select and open the relevant worksheet module from the panel on the left-hand side of the screen. Copy & paste the code to that module, then press Alt-F11 again to return to the workbook. Note that dates only be protected - other content will not be protected.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote