Batch/Multiple Find and Replace Help

rc193

New Member
Joined
Feb 25, 2012
Messages
5
Thank you in advance for taking the time to read this and possibly help out.

I need to find a way to find many different numbers across 4 columns (in another book) around 19K cells in each column and replace those numbers
with different numbers, for example.

Book1

Find Replace
34000 29232
In series In series 2700 times.

Book 2 contains the data in which the find number must be changed to the replace number across 4 columns.
There are a total of 2700 numbers that must be changed.

I hope I'm not confusing anyone because I have just about confused myself.

Again thanks to anyone willing to help me out.

RC
 
Last edited:

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
How about
Code:
Sub MultiReplace()

   Dim ws1 As Worksheet
   Dim Ws2 As Worksheet
   Dim Ary As Variant
   Dim i As Long
Application.ScreenUpdating = False

   Set ws1 = Workbooks("[COLOR=#ff0000]Book2[/COLOR].xlsm").Sheets("[COLOR=#ff0000]Sheet1[/COLOR]")
   Set Ws2 = Workbooks("[COLOR=#0000ff]Book1[/COLOR].xlsm").Sheets("[COLOR=#0000ff]Data[/COLOR]")
   
   Ary = ws1.Range("A2", ws1.Range("B" & Rows.count).End(xlUp))
   For i = LBound(Ary, 1) To UBound(Ary, 1)
      Ws2.Range("A:D").Replace Ary(i, 1), Ary(i, 2), xlWhole, , , , False, False
   Next i
End Sub
Change values in red to match the book/sheet where the old/new numbers are located (this assumes they are in col A & B).
Change values in Blue to match the book/sheet where you want to replace the numbers (this assumes they are in Cols A:D)
 
Upvote 0
Cross posted https://www.excelforum.com/excel-new-users-basics/1227553-find-and-replace-problem.html

Cross-Posting
While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules).
This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0

Forum statistics

Threads
1,223,909
Messages
6,175,315
Members
452,634
Latest member
cpostell

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