Dear members,
Sorry to disturb you again. I have two code snippets that are identical (except for one variable name):
Snippet 2
For i = 2 To Application.CountA(Range("A:A"))
For j = 2 To Application.CountA(Range("A:A"))
If TO_Sheet_OFA.Range("A" & i) = Filename_TO.Sheets("Extra_days").Range("A" & j) Then
TO_Sheet_OFA.Range("F" & i) = Filename_TO.Sheets("Extra_days").Range("B" & j)
End If
Next j
Next i
Snippet 1
For i = 2 To Application.CountA(Range("A:A"))
For j = 2 To Application.CountA(Range("A:A"))
If TO_Sheet_CTO.Range("A" & i) = Filename_TO.Sheets("Extra_days").Range("A" & j) Then
TO_Sheet_CTO.Range("F" & i) = Filename_TO.Sheets("Extra_days").Range("B" & j)
End If
Next j
Next i
Snippet 1 works, and copies the right information. Snippet 2 doesn't work, as column F remains empty after the code has been executed.
My suspicion at first that the source file (Filename_From, not shown in the text above) might be corrupted. I recreated the file, but that did not help.
I have attached the two code files in their entirity below. What are your theories?
EDIT: added workbooks.
Bookmarks