I need to find certain columns based on header name in 1 sheet and copy them to another. My code works for "Task Type" and "User". However it does not copy the other columns. I tried using 2 words and it worked. For ex. Instead of "User Email Address", I changed the column header and array to "User Email" and it worked. Is there a way to make it work for header with 3 words? Thanks
For Each vHeader In Array("Task Type", "User", "User Email Address", "User First Name", "User Last Name", "User Preferred Language")
Set rngFound = ws_A.Cells.Find(vHeader, , xlValues, xlWhole, 1, i)
i = i + 1
If Not rngFound Is Nothing Then
Range(rngFound, rngFound.End(xlDown)).Copy Destination:=ws_B.Cells(1, i)
End If
Next
For Each vHeader In Array("Task Type", "User", "User Email Address", "User First Name", "User Last Name", "User Preferred Language")
Set rngFound = ws_A.Cells.Find(vHeader, , xlValues, xlWhole, 1, i)
i = i + 1
If Not rngFound Is Nothing Then
Range(rngFound, rngFound.End(xlDown)).Copy Destination:=ws_B.Cells(1, i)
End If
Next