I'm trying to find an easier way to approach this task. I currently have a method that works but I'm trying to simplify things for editing.
We have a Team of Employees
TA = Split(employeenames,",")
I want to create a report exclusively for them. I have a way of filtering them out but it's cumbersome and now that I have two dozen reports I'm in charge of, I want to be able to make changes/edits easier. Here is my thought but it doesn't work but I don't know how to go about doing it. Out of my current skill range.
Note: the commented out section is the working portion in my current report. I'm trying to mimic the results but using an array/split method. Not getting the same results because Not ((Cells(iRow, "A").Value = TA(jRow))) isn't treated the same as my old bit of code.
Any help to steer me in the right direction would be appreciated. Thanks!
We have a Team of Employees
TA = Split(employeenames,",")
I want to create a report exclusively for them. I have a way of filtering them out but it's cumbersome and now that I have two dozen reports I'm in charge of, I want to be able to make changes/edits easier. Here is my thought but it doesn't work but I don't know how to go about doing it. Out of my current skill range.
Code:
Sub TeamArray()
Dim TA() As String
Dim iRow As Long
Dim jRow As Long
TA = Split("Employee1,Employee13,Employee16,Employee11,Employee9,Employee8,Employee45,Employee46,Employee47,Employee48,Employee51", ",")
LastRow = Sheets("Order Detail Report (Table Vers").Cells.find("*", , xlFormulas, xlPart, xlByRows, xlPrevious).Row
For iRow = LastRow To 2 Step -1
For jRow = LBound(TA) To UBound(TA)
If Not ((Cells(iRow, "A").Value = TA(jRow))) Then
Cells(iRow, "A").Offset(0, 1) = "#N/A"
End If
Next jRow
' If Not ((Cells(iRow, "A").Value = "Employee1") Or (Cells(iRow, "A").Value = Employee13") _
' Or (Cells(iRow, "A").Value = "Employee16") Or (Cells(iRow, "A").Value = "Employee11") _
' Or (Cells(iRow, "A").Value = "Employee9") Or (Cells(iRow, "A").Value = "Employee8") _
' Or (Cells(iRow, "A").Value = "Employee45") Or (Cells(iRow, "A").Value = "Employee46") _
' Or (Cells(iRow, "A").Value = "Employee47") Or (Cells(iRow, "A").Value = "Employee48") _
' Or (Cells(iRow, "A").Value = "Employee51")) Then
' Cells(iRow, "A").Offset(0, 1) = "#N/A"
' End If
Next iRow
On Error Resume Next
Columns("A").Offset(0, 1).SpecialCells(xlConstants, xlErrors).EntireRow.Delete 'Deletion's All employees from report not on Team process.
End Sub
Note: the commented out section is the working portion in my current report. I'm trying to mimic the results but using an array/split method. Not getting the same results because Not ((Cells(iRow, "A").Value = TA(jRow))) isn't treated the same as my old bit of code.
Any help to steer me in the right direction would be appreciated. Thanks!