my code paste value from sheet 1 to sheet 2 than get protected, i want after values get pasted in cell which are locked get unlock and remain unlock.
VBA Code:
Private Sub custnameonlysave_Click()
Dim CustRow As Long
Sheets("lists").Unprotect
If Me.custnameonlytextBox.Value = Empty Then
MsgBox "Please add customer name before saving", vbCritical, "Add Customer Name"
Exit Sub
End If
With Sheet1
If IsEmpty(Sheet2.Range("C8").Value) Then
CustRow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1
Else
CustRow = Sheet2.Range("A3").Value
End If
.Cells(CustRow, "A").Value = Me.custnameonlytextBox.Value
End With
CustNameOnly.Hide
Sheet2.Range("C8").Value = custnameonlytextBox.Value
Sheets("lists").Protect
End Sub