Hi I Need a help that when i click on save button the Non Blank
Cell will protect so that no one can edit the cell content .only the
Blank cell will edit
Hi I Need a help that when i click on save button the Non Blank
Cell will protect so that no one can edit the cell content .only the
Blank cell will edit
The default for cells is locked, so first unlock all the cells.
Click the empty grey box between the colmn & row headers to select all cells -> Format -> Protection -> uncheck Locked. Then use this code
![]()
Option Explicit Sub Button1_Click() Const PW As String = "secret" Dim rNonBlanks As Range On Error Resume Next Set rNonBlanks = ActiveSheet.UsedRange.SpecialCells(xlCellTypeConstants) On Error GoTo 0 rNonBlanks.Locked = True ActiveSheet.Protect PW End Sub
Hope that helps.
RoyUK
--------
For Excel Tips & Solutions, free examples and tutorials why not check out my web site
Free DataBaseForm example
The default for cells is locked, so first unlock all the cells.
Click the empty grey box between the colmn & row headers to select all cells -> Format -> Protection -> uncheck Locked. Then use this code
![]()
Option Explicit Sub Button1_Click() Const PW As String = "secret" Dim rNonBlanks As Range On Error Resume Next Set rNonBlanks = ActiveSheet.UsedRange.SpecialCells(xlCellTypeConstants) On Error GoTo 0 rNonBlanks.Locked = True ActiveSheet.Protect PW End Sub
please suggest
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks