Related:
- Copy rows into sheets depending on a condition in one column
- Sheets right to left - Guide
- Display two columns in data validation list but return only one - Guide
- How to delete a row in a table in word - Guide
- Mark sheet in excel - Guide
- How to open excel sheet in notepad++ - 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!