You need to right click the TabName of the sheet to open it's VBA panel then copy the macro in the right blank space.
Have a try with this after changing the sheet's name in the macro (now it is Sheet1):Code:Option Explicit Private Sub Worksheet_Change(ByVal Target As Range) Dim r As Long Dim c As Long Dim Cell As Range With Application .Calculation = xlCalculationManual .ScreenUpdating = False .DisplayAlerts = False End With If ActiveSheet.Name = "Sheet1" Then 'change name of sheet as needed 'Resume to next line if any error occurs On Error Resume Next With ActiveSheet .Unprotect 'unprotect entire sheet 'search for non blank cells and lock them and unlock blank cells For Each Cell In ActiveSheet.UsedRange r = Cell.Row c = Cell.Column If Cell.Value <> "" Then If Cell.Locked = False Then Cell.Locked = True End If Next Cell .Protect 'protect entire sheet End With With Application .Calculation = xlCalculationAutomatic .DisplayAlerts = True .ScreenUpdating = True End With End If End Sub




Reply With Quote
Bookmarks