Related:
- Copy rows into sheets depending on a condition in one column
- How to copy data from one sheet to another in excel automatically - Guide
- Excel copy data from one sheet to another if a condition is met - Excel Forum
- Vba find column by name ✓ - Excel Forum
- Copy cells from one sheet to another ✓ - Excel Forum
- Macro to copy data from one sheet to another based on criteria ✓ - Excel Forum
1 reply
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!