does anyone know how I can lock or unlock a cell based on a condition of another cell?
does anyone know how I can lock or unlock a cell based on a condition of another cell?
This event macro lets you edit B1 if A1 equals yes
See what you think
VBA Noob
_________________________________________
![]()
![]()
Credo Elvem ipsum etian vivere
_________________________________________
A message for cross posters
Please remember to wrap code.
Forum Rules
Please add to your signature if you found this link helpful. Excel links !!!
What "Kind" of condition are you talking about?
Use the Worksheet_Change event
Or substitute![]()
IF 'Your code for the condition to be met' THEN ActiveCell.Locked = False END IF IF NOT 'Your condition to be met' THEN ActiveCell.Locked = True END IF
if you want to lock (or unlock) a cell that is not the active cell.![]()
Range(myCell).Locked = TRUE Range(myCell).Locked = FALSE
Thanks!
Dennis
I am using Windows 7 and Office 2007, all of my posts are based on this.
or
Change B1 to your range.
and change Named range RestritiveRange to your cell or range
VBA Noob![]()
Private Sub Worksheet_Change(ByVal Target As Range) With ActiveSheet If Range("B1").Value = True Then .UsedRange.Cells.Locked = False .Range("RestritiveRange").Locked = True .Protect Password:="Secret" Else .Unprotect Password:="Secret" End If End With End Sub
I should have added that I want to do this without a macro
So why post under programming ??
Have you not read the rules below ??
VBA Noob
Well - maybe an equation + conditional formatting???
My situation would be a piece of cake if conditional formatting would allow a cell to be lock or unlocked base on a condition
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks