I'm attempting to create an assignment spreadsheet. This way someone can assign rows of data to an individual without the need to reference or mess up the master sheet.
I found a VBA option that kind of works as intended however it creates extra steps to make it "automated".
The code below gives me the end result I want, but has errors that popup during process.
For example: when i fill in information B - J, and go to select employee gives me debug error, I have to click end...than select employee from dropdown...and click the cell again to push the rows data to appropriate worksheet. Very basic knowledge on VBA code, manipulated below code to work for my sheet.
I want to fill in information from cells B - J, and once I select an employee from Column A dropdown list it pushes data over to that Employee's worksheet. (27 employees, tried an option where I created a module for each employee and had code to call said module based on input in column A was too intense on computer as it ran through call list every time I entered dropdown.)
Attached screenshot of very basic sheet structure. Employee worksheets will have same header information and they will manually update their own sheets.
I found a VBA option that kind of works as intended however it creates extra steps to make it "automated".
The code below gives me the end result I want, but has errors that popup during process.
For example: when i fill in information B - J, and go to select employee gives me debug error, I have to click end...than select employee from dropdown...and click the cell again to push the rows data to appropriate worksheet. Very basic knowledge on VBA code, manipulated below code to work for my sheet.
I want to fill in information from cells B - J, and once I select an employee from Column A dropdown list it pushes data over to that Employee's worksheet. (27 employees, tried an option where I created a module for each employee and had code to call said module based on input in column A was too intense on computer as it ran through call list every time I entered dropdown.)
Attached screenshot of very basic sheet structure. Employee worksheets will have same header information and they will manually update their own sheets.
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim ws As Worksheet
Dim rng As Range
Dim lastRow As Long
'Check if the changed cell is in column A (Assigned To)
If Target.Column = 1 Then
'Get the selected worksheet name
Set ws = Worksheets(Target.Value)
'Get the last row in the selected worksheet
lastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row + 1
'Copy row to selected worksheet
Set rng = Range("A" & Target.Row & ":S" & Target.Row)
rng.Copy ws.Range("A" & lastRow)
'Delete the row from Pending Applicants sheet
rng.Delete Shift:=xlUp
End If
End Sub