I uploaded images of how the sheet looks. Right now, the master is getting updated from the first vba code, I copy the data in to the input sheet and the master pulls the new entries. Maybe I worded incorrectly on the data being dynamic. It'll stay constant as I work. However, Column A is most important and new entries will appear when copied to the input sheet and a source in column A could show up again but be different data in the respective columns B-D.
Sub DetectionsMatches()
'using to check for matches with input and master list
Application.ScreenUpdating = False
Dim ar As Integer
Dim ar1 As Integer
Dim ttt As Integer
Dim foundtrue As Boolean
ar = Sheets("Input").Cells(Sheets("Input").Rows.Count, "A").End(xlUp).Row
arl = Sheets("Detections").Cells(Sheets("Detections").Rows.Count, "A").End(xlUp).Row
ttt = Sheets("Detections").Cells(Sheets("Detections").Rows.Count, "A").End(xlUp).Row
'checking to see if column A matches column A in input list
For i = 1 To ar
foundtrue = False
For Z = 1 To arl
If Sheets("Input").Cells(i, 2).Value = Sheets("Detections").Cells(Z, 2).Value Then
foundtrue = True
Exit For
End If
Next Z
Application.ScreenUpdating = True
Application.ScreenUpdating = False
'if no matches then copies to master sheet of detections
If Not foundtrue Then
Sheets("Input").Rows(i).copy Destination:=Sheets("Detections").Rows(ttt + 1)
ttt = ttt + 1
End If
Next i
Application.ScreenUpdating = True
End Sub
This is how i am pulling based on drop-down but it is just duplicating. I know where I think it should go for deleting and comparing...but haven't added to the code.
Sub Calloutbasedonvalue()
'using to call out data of column E and pushing to respective sheets
Dim xRg As Range
Dim a As Long
Dim b As Long
Dim c As Long
Dim G As Long
Dim E As Long
Dim F As Long
Dim j As Long
a = Worksheets("Bolster_Detections").UsedRange.Rows.Count
b = Worksheets("Suspicious").UsedRange.Rows.Count
c = Worksheets("Resolved").UsedRange.Rows.Count
G = Worksheets("Pending").UsedRange.Rows.Count
E = Worksheets("Chapter").UsedRange.Rows.Count
F = Worksheets("Squat").UsedRange.Rows.Count
j = Worksheets("Completed").UsedRange.Rows.Count
'calling on suspicious list
If b = 1 Then
If Application.WorksheetFunction.CountA(Worksheets("Suspicious").UsedRange) = 0 Then b = 0
End If
Set xRg = Worksheets("Bolster_Detections").Range("E3:E" & a)
On Error Resume Next
Application.ScreenUpdating = False
For b = 1 To xRg.Count
If CStr(xRg(b).Value) = "Suspicious" Then
xRg(b).EntireRow.copy Destination:=Worksheets("Suspicious").Range("A" & Rows.Count).End(xlUp).Offset(1)
End If
Next
'move to offline/complete sheet
Application.ScreenUpdating = True
If b = 1 Then
If Application.WorksheetFunction.CountA(Worksheets("Completed").UsedRange) = 0 Then b = 0
End If
Set xRg = Worksheets("Suspicious").Range("E3:E" & b)
On Error Resume Next
Application.ScreenUpdating = False
For b = 1 To xRg.Count
If CStr(xRg(b).Value) = "Offline/Completed" Then
xRg(b).EntireRow.copy Destination:=Worksheets("Completed").Range("A" & Rows.Count).End(xlUp).Offset(1)
End If
Next
'comparison and remove step inserted here
Application.ScreenUpdating = True
'calling on chapter selection
If E = 1 Then
If Application.WorksheetFunction.CountA(Worksheets("Chapter").UsedRange) = 0 Then E = 0
End If
Set xRg = Worksheets("Bolster_Detections").Range("E3:E" & a)
On Error Resume Next
Application.ScreenUpdating = False
For E = 1 To xRg.Count
If CStr(xRg(E).Value) = "Chapter" Then
xRg(E).EntireRow.copy Destination:=Worksheets("Chapter").Range("A" & Rows.Count).End(xlUp).Offset(1)
End If
Next
'move to offline/complete sheet
Application.ScreenUpdating = True
'comparison and remove step inserted here
'calling on squat section
If F = 1 Then
If Application.WorksheetFunction.CountA(Worksheets("Squat").UsedRange) = 0 Then F = 0
End If
Set xRg = Worksheets("Bolster_Detections").Range("E3:E" & a)
On Error Resume Next
Application.ScreenUpdating = False
For F = 1 To xRg.Count
If CStr(xRg(F).Value) = "Squat" Then
xRg(F).EntireRow.copy Destination:=Worksheets("Squat").Range("A" & Rows.Count).End(xlUp).Offset(1)
'move to offline/complete sheet
End If
Next
Application.ScreenUpdating = True
'comparison and remove step inserted here
'calling on pending selection
If G = 1 Then
If Application.WorksheetFunction.CountA(Worksheets("Pending").UsedRange) = 0 Then G = 0
End If
Set xRg = Worksheets("Bolster_Detections").Range("E3:E" & a)
On Error Resume Next
Application.ScreenUpdating = False
For G = 1 To xRg.Count
If CStr(xRg(G).Value) = "Pending" Then
xRg(G).EntireRow.copy Destination:=Worksheets("Pending").Range("A" & Rows.Count).End(xlUp).Offset(1)
'move to offline/complete sheet inserted here
End If
Next
Application.ScreenUpdating = True
'comparison and remove step inserted here
'calling on resolved selection
If c = 1 Then
If Application.WorksheetFunction.CountA(Worksheets("Resolved").UsedRange) = 0 Then c = 0
End If
Set xRg = Worksheets("Bolster_Detections").Range("E3:E" & a)
On Error Resume Next
Application.ScreenUpdating = False
For c = 1 To xRg.Count
If CStr(xRg(c).Value) = "Resolved" Then
xRg(c).EntireRow.copy Destination:=Worksheets("Resolved").Range("A" & Rows.Count).End(xlUp).Offset(1)
End If
Next
Application.ScreenUpdating = True
'runs if completed or offline marked on master list
If j = 1 Then
If Application.WorksheetFunction.CountA(Worksheets("Completed").UsedRange) = 0 Then j = 0
End If
Set xRg = Worksheets("Bolster_Detections").Range("E3:E" & a)
On Error Resume Next
Application.ScreenUpdating = False
For j = 1 To xRg.Count
If CStr(xRg(j).Value) = "Offline/Completed" Then
xRg(j).EntireRow.copy Destination:=Worksheets("Completed").Range("A" & Rows.Count).End(xlUp).Offset(1)
Application.ScreenUpdating = True
End If
Next
End Sub