Hello all,
The resource feeding one of my workbooks has changed.
The source now puts an entry everytime it is entered in the database. This results in many lines with almost identical information. I nee to adjust the logic at the start to account for this.
Here is the code:
The code needs to account for column 2 for status and then column 3 for name. If these two are found look to column 1 for SampleID and then find the last row (potentially 1,000) that does not state "CLS" in Column 27 and get information.
Any ideas?
The resource feeding one of my workbooks has changed.
The source now puts an entry everytime it is entered in the database. This results in many lines with almost identical information. I nee to adjust the logic at the start to account for this.
Here is the code:
Code:
Sub Workie()
Dim LastRow, SecondRow As Long
Dim i As Long
Dim j As Long
LastRow = Sheets("Initial Query Pull").Cells(Rows.Count, "A").End(xlUp).Row
SecondRow = Sheets(3).Cells(Rows.Count, "B").End(xlUp).Row
i = 1 + LastRow
j = 1 + SecondRow
For i = 1 To LastRow 'Each i In Sheets("Initial Query Pull")
If Sheets("Initial Query Pull").Cells(i, 2) = "Work" And Sheets("Initial Query Pull").Cells(i, 27) _
= "CLS" Is Nothing And Sheets("Initial Query Pull").Cells(i, 20) <> "" And (Sheets("Initial Query Pull").Cells(i, 11) _
= " " Or Sheets("Initial Query Pull").Cells(i, 11) = "") Then
Sheets("Workable").Cells(j, 1) = Format(Now(), "DD-MMM-YYYY")
'Complaint ID
Sheets(3).Cells(j, 2) = Sheets("Initial Query Pull").Cells(i, 1).Value
j = j + 1
End If
Next i
End Sub
The code needs to account for column 2 for status and then column 3 for name. If these two are found look to column 1 for SampleID and then find the last row (potentially 1,000) that does not state "CLS" in Column 27 and get information.
Any ideas?