I would like to be able to automate a find and replace, I have two sheets
The first only has two columns
-----------------------------------------------
| Column 1 | Column 2 |
-----------------------------------------------
| PO-123-LG | Polygon base Lime Green |
| PO-123-PR | Polygon base Plain Red |
| PO-123-SY | Polygon base Sunset Yellow |
| HO-123-LG | Horice base Lime Green |
-----------------------------------------------
The second sheet has two columns also
-----------------------------------------------
| Column 1 | Column 2 |
-----------------------------------------------
| Lime Green | (Lime-Green) |
| Plain Red | (Plain-Red) |
| Sunset Yellow | (Sunset-Yellow) |
-----------------------------------------------
I would like to use the second sheet to find column 1 in the first sheet column 2 and replace it with column 2 on the second sheet so that I now have
-------------------------------------------------------
| Column 1 | Column 2 |
-------------------------------------------------------
| PO-123-LG | Polygon base (Lime-Green) etc etc. |
-------------------------------------------------------
Is there any way that I can automate this as I have nearly 50000 rows and doing this manually will be too time consuming.
Any help would be much appreciated.
Sub replacing()
i = 2
Do While (Len(Sheets("B").Cells(i, 2)) > 0)
Sheets("A").Columns("B:B").Replace What:=Sheets("B").Cells(i, 1), Replacement:=Sheets("B").Cells(i, 2), LookAt:=xlPart, SearchOrder:=xlByRows
i = i + 1
Loop
End Sub
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.