I'm making multiple userforms on one Workbook. each userform is used to enter data on a different sheet (different inputs and different columns for different sheets)
It used to enter data almost instantaneously however now it's taking about 10 seconds after i press the enter button.
I've pasted my entire Userform code below but the data entry code is the last Sub called EnterButton_Click
What am i not seeing?
It used to enter data almost instantaneously however now it's taking about 10 seconds after i press the enter button.
I've pasted my entire Userform code below but the data entry code is the last Sub called EnterButton_Click
What am i not seeing?
Code:
Private Sub AssigneeBox_Change()
TextBox2.Value = Format(WorksheetFunction.VLookup(AssigneeBox.Value, Worksheets("CustomerList").Range("A2:C245"), 3, False), "####0000")
End Sub
Private Sub AssignorBox_Change()
TextBox1.Value = Format(WorksheetFunction.VLookup(AssignorBox.Value, Worksheets("CustomerList").Range("A2:C245"), 3, False), "####0000")
End Sub
Private Sub UserForm_Initialize()
AssignorBox.RowSource = "Customer"
AssigneeBox.RowSource = "Customer"
RecByBox.RowSource = "UserID"
With RecMethodBox
.AddItem "Phone"
.AddItem "Email"
.AddItem "Fax"
'MktrID = WorksheetFunction.VLookup(CustBox.Value, Worksheets("CustomerSheet").Range("Customers"), 3, False)
End With
TextBox2.Locked = True
TextBox2.BackColor = &H80000000
TextBox1.Locked = True
TextBox1.BackColor = &H80000000
End Sub
Private Sub CancelButton_Click()
Unload Me
End Sub
Private Sub EnterButton_Click()
Dim LastRow As Long, ws As Worksheet
Set ws = Sheets("Assignments")
LastRow = ws.Range("D" & Rows.Count).End(xlUp).Row + 1 'Finds the last blank row
ws.Range("C" & LastRow).Value = AssignorBox.Text
ws.Range("D" & LastRow).Value = WorksheetFunction.VLookup(AssignorBox.Value, Worksheets("CustomerList").Range("A2:C245"), 3, False)
ws.Range("E" & LastRow).Value = AssigneeBox.Text
ws.Range("F" & LastRow).Value = WorksheetFunction.VLookup(AssigneeBox.Value, Worksheets("CustomerList").Range("A2:C245"), 3, False)
ws.Range("B" & LastRow).Value = RecByBox.Text
ws.Range("A" & LastRow).Value = Format(Now(), "MM/DD/YY")
ws.Range("G" & LastRow).Value = RecMethodBox.Text
ws.Range("J" & LastRow).Value = CommentBox.Text
Unload Me
End Sub