I would like to write a procedure that copies and pastes data from one workbook to another, contingent on 'labels' in two ranges.
Basically I would like to loop through one range, copy data next to each cell, then paste it elsewhere based on a corresponding cell value in the second range. I can do this with a bunch of IF statements, but if someone could suggest a more efficient option using variables or arrays, that would be much appreciated, as it obviously becomes tedious with large data sets.
Thank you.
For Each ColourCell In CopyRange
If ColourCell.Value = "Blue" Then
ColourCell.Offset(, 1).Copy
PasteRange.Find("Aqua").Offset(, 1).PasteSpecial xlPasteValues
Else
End If
If ColourCell.Value = "Red" Then
ColourCell.Offset(, 1).Copy
PasteRange.Find("Pink").Offset(, 1).PasteSpecial xlPasteValues
Else
End If
If ColourCell.Value = "Yellow" Then
ColourCell.Offset(, 1).Copy
PasteRange.Find("Orange").Offset(, 1).PasteSpecial xlPasteValues
Else
End If
Next