How do I automate find and replace.

ghrek

Active Member
Joined
Jul 29, 2005
Messages
426
Hi

I have a workbook that in column A on sheet 1 each row has different 3 letters.

On sheet 2 of the same workbook I have in column A the same 3 letters and in column B the meaning of the 3 letters. What Im trying to do is to get it to look on sheet 1 in column A and then find it on sheet 2 and replace data on sheet 1 with the meaning thats in column B

Lets say in column A on sheet 1 says BDY at various locations and then in sheet 2 column A = BDY and the adjacent data in the same row in column B says return I need all data that has BDY on sheet 1 replaced by return.

There will be numerous different options.

Any ideas?
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
How about
Code:
Sub ghrek()
   Dim Ary As Variant
   Dim i As Long
   With Sheets("Sheet2")
      ary = .Range("A2", .Range("A" & Rows.Count).End(xlUp).Offset(, 1)).Value2
   End With
   For i = 1 To UBound(ary)
      Sheets("Sheet1").Range("A:A").Replace ary(i, 1), ary(i, 2), xlWhole, , False, , False, False
   Next i
End Sub
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,214,403
Messages
6,119,308
Members
448,886
Latest member
GBCTeacher

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top