I have a protected Excel sheet that populates it's cell through a userform. Everything works great except that I have the cells locked down so that employees cannot change other employees data on accident. The problem i'm running into is that if an employee makes an unseen error then clicks Enter, they cannot edit the data and must contact support. Is there a way that I can create an Edit button or some other feature that would allow the employee to select a certain row and edit just the data in that row? Thank you.
Here is my code:
Here is my code:
Code:
Private Sub Label1_Click()
btnProspect.GroupName = "CustomerType"
btnCurrent.GroupName = "CustomerType"
End Sub
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdEnter_Click()
ActiveSheet.Unprotect Password:="fscbcall"
Dim RowCount As Long
Dim benefits, total As Single
' Write data to worksheet
RowCount = Worksheets("Current Month").Range("A1").CurrentRegion.Rows.Count
With Worksheets("Current Month").Range("A1")
.Offset(RowCount, 0).Value = Me.txtInitials.Value
.Offset(RowCount, 1).Value = Me.txtName.Value
.Offset(RowCount, 2).Value = Me.btnProspect.Value
.Offset(RowCount, 2).Value = Me.btnCurrent.Value
.Offset(RowCount, 3).Value = Me.txtDate.Value
.Offset(RowCount, 4).Value = Me.chkTop.Value
.Offset(RowCount, 5).Value = Me.txtRemarks.Value
.Offset(RowCount, 6).Value = Me.txtFollowupdt.Value
.Offset(RowCount, 7).Value = Me.txtFollowupcmt.Value
If Me.chkTop.Value = True Then
.Offset(RowCount, 4).Value = "Yes"
Else
.Offset(RowCount, 4).Value = "No"
End If
If btnCurrent.Value = True Then
.Offset(RowCount, 2) = "Current"
ElseIf btnProspect.Value = True Then
.Offset(RowCount, 2) = "Prospect"
End If
End With
'Clear the form
Unload Me
With Worksheets("Current Month")
With .Range("A7:H200")
.Sort Key1:=.Columns("A"), Order1:=xlAscending, Key2:=.Columns("D"), Order2:=xlAscending, Header:=xlNo, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
DataOption1:=xlSortNormal
End With
ActiveSheet.Protect Password:="fscbcall", DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowSorting:=True, AllowFiltering:=True, AllowUsingPivotTables:=True
End With
End Sub
Private Sub Textbox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If Not txtDate.Value Like "##[/]##[/]####" Then
MsgBox "Must Be Format mm/dd/yyyy"
Textbox1.SetFocus
Cancel = True
Textbox1.Value = ""
Else: chkTop.Value
End If
End Sub
Private Sub txtRemarks_Change()
End Sub
Private Sub UserForm_Click()
End Sub
Last edited by a moderator: