Related:
- Copy rows into sheets depending on a condition in one column
- Google sheets right to left - Guide
- How to delete a column in word - Guide
- Display two columns in data validation list but return only one - Guide
- How to copy data from one excel sheet to another - Guide
- Excel count occurrences of string in column - Guide
1 response
You are not Resetting the count after scrubbing for a value. So in other words, take a look here:
d = 1
j = 2
Do Until IsEmpty(i.Range("D" & j))
If i.Range("D" & j) = "EMAS" Then
d = d + 1
e.Rows(d).Value = i.Rows(j).Value
End If
j = j + 1
Loop
At this point, J is greater than 2, and EEAST might have been the first entry, but you didn't check for it.
Then you are starting at D3 to look for EEAST, and it doesn't find it.
You need to run the whole loop before you increment to the next cell to check for logic, OR run a nested loop that will reset the counts to check for the new logic!
d = 1
j = 2
Do Until IsEmpty(i.Range("D" & j))
If i.Range("D" & j) = "EMAS" Then
d = d + 1
e.Rows(d).Value = i.Rows(j).Value
End If
j = j + 1
Loop
At this point, J is greater than 2, and EEAST might have been the first entry, but you didn't check for it.
Then you are starting at D3 to look for EEAST, and it doesn't find it.
You need to run the whole loop before you increment to the next cell to check for logic, OR run a nested loop that will reset the counts to check for the new logic!