Is it possible to flag an unlocked/unprotected cell to locked if blank, with a formula?
Is it possible to flag an unlocked/unprotected cell to locked if blank, with a formula?
Last edited by SIXFORTYSIX; 09-29-2010 at 03:35 PM.
You can't change the lock flag with a formula. You'll need VBA.
Like below
![]()
Private Sub Worksheet_Change(ByVal Target As Range) Dim Cell As Range On Error GoTo ErrHandler Me.Unprotect For Each Cell In Cells.SpecialCells(xlCellTypeFormulas) With Cell If .Value = "" Then .Locked = True Else .Locked = False End If End With Next Cell Me.Protect Exit Sub ErrHandler: If Err.Number > 0 Then Err.Clear Resume Next End If End Sub
How to Save a Workbook Event Macro
- Copy the macro using CTRL+C keys.
- Open your Workbook and Right Click on any Worksheet's Name Tab
- Left Click on View Code in the pop up menu.
- Press the Enter key to move the cursor to the Code Window
- Paste the macro code using CTRL+V
- Save the macro in your Workbook using CTRL+S
Last edited by contaminated; 09-23-2010 at 05:53 PM.
Люди, питающие благие намерения, как раз и становятся чудовищами.
Regards, ?Born in USSR?
Vusal M Dadashev
Baku, Azerbaijan
I've Adapted that VBA and it works!!!! Thanks!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks