I have a list of codes in "C" column of Sheet2, and
if the code begins with "xxx" I need to copy value from "D" column of Sheet2
to "A" column of Sheet1,
otherwise to "B" column of Sheet1.
Here's my code.
It's simple, but it works.
Because I have large list of data, is it possible
to it more effectively.
if the code begins with "xxx" I need to copy value from "D" column of Sheet2
to "A" column of Sheet1,
otherwise to "B" column of Sheet1.
Here's my code.
It's simple, but it works.
Code:
Set ws1 = Sheets("Sheet2")
Set ws2 = Sheets("Sheet1")
FinalRow = ws1.Cells(Rows.Count, "C").End(xlUp).Row
For i = 1 To FinalRow
If Left(ws1.Range("c" & i).Value, 3) = "xxx" Then
k = k + 1
ws2.Range("A" & k).Value = ws1.Range("D" & i).Value
Else
j = j + 1
ws2.Range("B" & j).Value = ws1.Range("D" & i).Value
End If
Next
Because I have large list of data, is it possible
to it more effectively.