Help!!!
I have a code to look at a result table (QA_Table) column to make sure the results are not duplicated when adding new entries from a worksheet to the table. These two worksheets are in the same workbook.
I had it working and it stopped working. I have been tinkering with it and it just repeats the same results already in the table!
Here is the code:
Trouble Code is in red
Arrrrgh,
DThib
I have a code to look at a result table (QA_Table) column to make sure the results are not duplicated when adding new entries from a worksheet to the table. These two worksheets are in the same workbook.
I had it working and it stopped working. I have been tinkering with it and it just repeats the same results already in the table!
Here is the code:
Code:
Sub Newt()
Dim MBs As Worksheet, Coos As Worksheet, QAws As Worksheet
Dim MBRow As Long, CoRow As Long, QArow As Long
Dim m As Long, j As Long, l As Long, g As Long
Dim x As Long, y As Long, a As Long
Dim b1 As String
[COLOR=#b22222] Dim TBL1, TBL2, TabC As Range[/COLOR]
Set MBs = ThisWorkbook.Sheets("MB51_Draw")
Set Coos = ThisWorkbook.Sheets("COOIS_Draw")
Set QAws = ThisWorkbook.Sheets("QA_Data")
[COLOR=#b22222] Set tbl = Sheets("QA_Data") '.ListObjects("QA_Table")[/COLOR]
[COLOR=#b22222] With tbl[/COLOR]
[COLOR=#b22222] Set TBL1 = .Range("C2", .Range("C1").End(xlDown))[/COLOR]
[COLOR=#b22222] End With[/COLOR]
[COLOR=#b22222] Set searchw = Sheets("COOIS_Draw")[/COLOR]
[COLOR=#b22222] With searchw[/COLOR]
[COLOR=#b22222] Set TBL2 = .Range("A2", .Range("A1").End(xlDown))[/COLOR]
[COLOR=#b22222] End With[/COLOR]
[COLOR=#b22222] For Each TabC In TBL1[/COLOR]
[COLOR=#b22222] If WorksheetFunction.CountIf(TBL2, TabC) = 0 Then[/COLOR]
[COLOR=#b22222] tbl.Range("C" & Rows.Count).End(xlUp) = TabC[/COLOR]
MBRow = MBs.Cells(Rows.Count, "B").End(xlUp).Row
CoRow = Coos.Cells(Rows.Count, "B").End(xlUp).Row
QArow = QAws.Cells(Rows.Count, "C").End(xlUp).Row
j = QArow + 1
g = MBRow
m = CoRow
For m = 1 To CoRow
For g = 1 To MBRow
If Coos.Cells(m, 1) = MBs.Cells(g, 13).Value And MBs.Cells(g, 12) Like "5*" Then
QAws.Cells(j, 1) = Coos.Cells(m, 4).Value
QAws.Cells(j, 2) = Coos.Cells(m, 5).Value
QAws.Cells(j, 3) = MBs.Cells(g, 13).Value
QAws.Cells(j, 4) = MBs.Cells(g, 17).Value
QAws.Cells(j, 5) = MBs.Cells(g, 14).Value
j = j + 1
End If
Next g
Next m
End If
Next
End Sub
Trouble Code is in red
Arrrrgh,
DThib
Last edited: