Hi everybody!
I've got to copy ~350 rows of data (individually) from one worksheet to another if the value of cell1 in the source row matches the cell1 value of the target row.
At the moment I am running two "For ... Next" loops within each other
For source_i = 1 To source_max
source_code = Worksheets(source).Range("A" & rp_i).Value
For target_i = i To target_row
If Worksheets(target).Range("A" & target_i).Value = source_code Then ' Found source
Call CopyValues(Worksheets(source).Range(source_i & ":" & source_i), Worksheets(target).Range("A" & target_i)
End If
Next target_i
Next source_i
Sub CopyValues(rngSource As Range, rngTarget As Range)
rngTarget.Resize(rngSource.rows.Count, rngSource.Columns.Count).Value = rngSource.Value
End Sub
As you can expect, browsing through 2x 350 rows and updating each of them in this way is not really high-performance code.
How would you tackle that? What's the fastest way to realize this?
Happy to hear your ideas!
Best regards,
Andreas
Bookmarks