Hi excel gurus, My requirement is to lock cells to avoid tampering as files is being accessed by many users.
I have found below code which does the work, But If worksheet contains merged cells this script doesn't seems to be working. Could some please help fixing this issue
-------------
Sub Main()
With ActiveSheet
.Unprotect Password:="oVc0obr02WpXeZGy"
.Cells.Locked = False
For Each Cell In ActiveSheet.UsedRange
If Cell.Value = "" Then
Cell.Locked = False
Else
Cell.Locked = True
End If
Next Cell
.Protect Password:="oVc0obr02WpXeZGy"
End With
End Sub
------------------
Regards--Var
Bookmarks