Hello. The follow codes worked before I protected the sheet. However, the job stopped in the red statement and pop up the Run-Time error '1004' after I protected the worksheet. Can anyone please help? I highly appreciate!
Private Sub Worksheet_Change(ByVal Target As Range)
ThisWorkbook.Worksheets("test").Protect Password:="test", UserinterfaceOnly:=True
Dim LRow As Integer
LRow = Sheets("draft").Range("A65536").End(xlUp).Row
ActiveWorkbook.Names("GroupName").Delete
Sheets("draft").Range("A2:A" & LRow).Name = "GroupName"
Range("L" & ActiveCell.Row).ClearContents
With Range("L" & ActiveCell.Row)
With .Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="=GroupName"
End With
End With
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
ThisWorkbook.Worksheets("test").Protect Password:="test", UserinterfaceOnly:=True
Dim LRow As Integer
LRow = Sheets("draft").Range("A65536").End(xlUp).Row
ActiveWorkbook.Names("GroupName").Delete
Sheets("draft").Range("A2:A" & LRow).Name = "GroupName"
Range("L" & ActiveCell.Row).ClearContents
With Range("L" & ActiveCell.Row)
With .Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:="=GroupName"
End With
End With
End Sub