Press Alt+F11 to open the Visual Basic Editor, double-click ThisWorkbook in the Project window, and paste this code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim rB As Range
Dim cell As Range
With Worksheets("Sheet1") ' change as appropriate
.Protect Password:="secret", UserInterfaceOnly:=True
Set rB = Intersect(.Columns("B"), .UsedRange)
If rB Is Nothing Then Exit Sub
For Each cell In rB
cell.EntireRow.Locked = IsNumeric(cell.Value) And Not IsEmpty(cell.Value)
Next cell
End With
End Sub
Change the sheet name and password appropriately.
Save as type xlsm.
Bookmarks