Dear Forum,
I currently have the below code in my workbook that transfers data from a data sheet into individual employee sheets. This works fine so far but I would like to ask if anyone could please assist me in a few adjustments?
What I am trying to achieve with the amendments would be:
1. Is it possible when the user hits the Submit button on the UserForm1 that the sheets automatically update? reason I ask is that now it works great but I need to run the code each time new data is added, and this then means duplicate entries, which would also lead me to ask;
2. if 1. is possible is there a way to avoid duplicate entries? however it is possible the same ticket number a. could appear for more than 1 user and b. could appear more than once for the same user
Sub transfer()
Dim ws As Worksheet, wsName As Worksheet
Dim lRow As Long, lPaste As Long
Dim sName As String
Set ws = Worksheets("Update Quality Check Data")
With ws
For lRow = 2 To .Cells(Rows.Count, 1).End(xlUp).Row
sName = .Cells(lRow, 2)
On Error GoTo NoSheettFound
Jumper:
Set wsName = Worksheets(sName)
On Error GoTo 0
lPaste = wsName.Cells(Rows.Count, 3).End(xlUp).Row + 1
.Cells(lRow, 1).Copy Destination:=wsName.Cells(lPaste, 3)
.Cells(lRow, 3).Copy Destination:=wsName.Cells(lPaste, 4)
Next lRow
End With
Exit Sub
NoSheettFound:
Set wsName = ThisWorkbook.Sheets.Add(After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count))
wsName.Name = sName
ws.Select
GoTo Jumper
End Sub
Display More
Kind Regards
Bob