How to Auto Lock Cell after Data entry in Excel VBA Code: Private Sub Worksheet_Change(ByVal Target As Range) Dim kk As Range On Error Resume Next Set kk = Intersect(Range("b3:c12"), Target) If kk Is Nothing Then Exit Sub Target.Worksheet.Unprotect Password:="222" kk.Locked = True Target.Worksheet.Protect Password:="222" End Sub
Posts
Showing posts from December, 2022
- Get link
- X
- Other Apps
How To Prevent / Restriction Duplicate Entry in Excel VBA Code; Private Sub Worksheet_Change(ByVal Target As Range) With Target If (.Column <> 2 And .Column <> 5) Or .Cells.Count > 1 Then Exit Sub If WorksheetFunction.CountIfs(Columns(.Column), .Value) > 1 Then Application.DisplayAlerts = False .ClearContents Application.DisplayAlerts = True MsgBox "Duplicate value!" End If End With End Sub